summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Heisterkamp <she@delegate.dk>2021-09-19 11:56:46 +0200
committerAndi Albrecht <albrecht.andi@gmail.com>2022-08-24 21:14:38 +0200
commit403de6fc648ac4e012b60b49161c3f5f36dc944a (patch)
tree84d39183eb64729173a2c7c39d68489bfd8a1237
parenta17248666f8bafaacf16016f797c830af4d0102e (diff)
downloadsqlparse-403de6fc648ac4e012b60b49161c3f5f36dc944a.tar.gz
Fixed bad parsing of create table statements that use lower case
-rw-r--r--sqlparse/engine/grouping.py4
-rw-r--r--tests/test_grouping.py4
2 files changed, 6 insertions, 2 deletions
diff --git a/sqlparse/engine/grouping.py b/sqlparse/engine/grouping.py
index d250e18..86d8fc6 100644
--- a/sqlparse/engine/grouping.py
+++ b/sqlparse/engine/grouping.py
@@ -343,9 +343,9 @@ def group_functions(tlist):
has_table = False
has_as = False
for tmp_token in tlist.tokens:
- if tmp_token.value == 'CREATE':
+ if tmp_token.value.upper() == 'CREATE':
has_create = True
- if tmp_token.value == 'TABLE':
+ if tmp_token.value.upper() == 'TABLE':
has_table = True
if tmp_token.value == 'AS':
has_as = True
diff --git a/tests/test_grouping.py b/tests/test_grouping.py
index 8c034f9..546ad4b 100644
--- a/tests/test_grouping.py
+++ b/tests/test_grouping.py
@@ -660,3 +660,7 @@ def test_grouping_as_cte():
assert p[0].get_alias() is None
assert p[2].value == 'AS'
assert p[4].value == 'WITH'
+
+def test_grouping_create_table():
+ p = sqlparse.parse("create table db.tbl (a string)")[0].tokens
+ assert p[4].value == "db.tbl"