Repository: andialbrecht/sqlparse

Issue:
Support CONCURRENTLY keyword in CREATE INDEX statements
When parsing a statement like `CREATE INDEX CONCURRENTLY name ON ...`, "CONCURRENTLY name" is returned as a single identifier 

Discussion:

Patch:
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,


Test patch:
diff --git a/tests/test_regressions.py b/tests/test_regressions.py
index cf88419..cc553c2 100644
--- a/tests/test_regressions.py
+++ b/tests/test_regressions.py
@@ -343,3 +343,16 @@ def test_issue315_utf8_by_default():
     if PY2:
         tformatted = tformatted.decode('utf-8')
     assert formatted == tformatted
+
+
+def test_issue322_concurrently_is_keyword():
+    s = 'CREATE INDEX CONCURRENTLY myindex ON mytable(col1);'
+    p = sqlparse.parse(s)[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'