diff options
| author | Rowan Seymour <rowanseymour@gmail.com> | 2017-02-09 11:13:06 +0200 |
|---|---|---|
| committer | Rowan Seymour <rowanseymour@gmail.com> | 2017-02-09 11:13:06 +0200 |
| commit | 7c37c7f9132028b5af9c02bcccc33bef1c33787a (patch) | |
| tree | 41e41653527f3920787a596a7514aee93d916536 | |
| parent | d67c442db4fd8b60a97440e84b9c21e80e4e958c (diff) | |
| download | sqlparse-7c37c7f9132028b5af9c02bcccc33bef1c33787a.tar.gz | |
CONCURRENTLY should be handled as a keyword
| -rw-r--r-- | sqlparse/keywords.py | 1 | ||||
| -rw-r--r-- | tests/test_regressions.py | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/sqlparse/keywords.py b/sqlparse/keywords.py index 1fd07c1..d68b4ae 100644 --- a/sqlparse/keywords.py +++ b/sqlparse/keywords.py @@ -167,6 +167,7 @@ KEYWORDS = { 'COMMIT': tokens.Keyword.DML, 'COMMITTED': tokens.Keyword, 'COMPLETION': tokens.Keyword, + 'CONCURRENTLY': tokens.Keyword, 'CONDITION_NUMBER': tokens.Keyword, 'CONNECT': tokens.Keyword, 'CONNECTION': tokens.Keyword, diff --git a/tests/test_regressions.py b/tests/test_regressions.py index cf88419..4e76229 100644 --- a/tests/test_regressions.py +++ b/tests/test_regressions.py @@ -343,3 +343,15 @@ def test_issue315_utf8_by_default(): if PY2: tformatted = tformatted.decode('utf-8') assert formatted == tformatted + + +def test_issue322_concurrently_is_keyword(): + p = sqlparse.parse('CREATE INDEX CONCURRENTLY myindex ON mytable(col1);')[0] + + assert len(p.tokens) == 12 + assert p.tokens[0].ttype is T.Keyword.DDL # CREATE + assert p.tokens[2].ttype is T.Keyword # INDEX + assert p.tokens[4].ttype is T.Keyword # CONCURRENTLY + assert p.tokens[4].value == 'CONCURRENTLY' + assert isinstance(p.tokens[6], sql.Identifier) + assert p.tokens[6].value == 'myindex' |
