Skip to content

Commit 7c37c7f

Browse files
committed
CONCURRENTLY should be handled as a keyword
1 parent d67c442 commit 7c37c7f

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

sqlparse/keywords.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ def is_keyword(value):
167167
'COMMIT': tokens.Keyword.DML,
168168
'COMMITTED': tokens.Keyword,
169169
'COMPLETION': tokens.Keyword,
170+
'CONCURRENTLY': tokens.Keyword,
170171
'CONDITION_NUMBER': tokens.Keyword,
171172
'CONNECT': tokens.Keyword,
172173
'CONNECTION': tokens.Keyword,

tests/test_regressions.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,3 +343,15 @@ def test_issue315_utf8_by_default():
343343
if PY2:
344344
tformatted = tformatted.decode('utf-8')
345345
assert formatted == tformatted
346+
347+
348+
def test_issue322_concurrently_is_keyword():
349+
p = sqlparse.parse('CREATE INDEX CONCURRENTLY myindex ON mytable(col1);')[0]
350+
351+
assert len(p.tokens) == 12
352+
assert p.tokens[0].ttype is T.Keyword.DDL # CREATE
353+
assert p.tokens[2].ttype is T.Keyword # INDEX
354+
assert p.tokens[4].ttype is T.Keyword # CONCURRENTLY
355+
assert p.tokens[4].value == 'CONCURRENTLY'
356+
assert isinstance(p.tokens[6], sql.Identifier)
357+
assert p.tokens[6].value == 'myindex'

0 commit comments

Comments
 (0)