Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bad parsing of create table statements that use lower case #642

Merged
merged 1 commit into from
Aug 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sqlparse/engine/grouping.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,9 @@ def group_functions(tlist):
has_create = False
has_table = 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 has_create and has_table:
return
Expand Down
4 changes: 4 additions & 0 deletions tests/test_grouping.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,3 +655,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"