Skip to content

Commit

Permalink
Fixed bad parsing of create table statements that use lower case
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Heisterkamp authored and andialbrecht committed Aug 24, 2022
1 parent a172486 commit 403de6f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sqlparse/engine/grouping.py
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions tests/test_grouping.py
Expand Up @@ -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"

0 comments on commit 403de6f

Please sign in to comment.