Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ Bug Fixes

* Fix statement splitting (issue845).
* Fix a late-binding closure bug in `TokenList.token_not_matching`.
* Recognize ``ROW_FORMAT`` as a keyword so that ``ALTER TABLE ... ROW_FORMAT=...``
no longer merges the table name and the option into a single identifier
(issue773).


Release 0.5.5 (Dec 19, 2025)
Expand Down
1 change: 1 addition & 0 deletions sqlparse/keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@
'ROUTINE_SCHEMA': tokens.Keyword,
'ROWS': tokens.Keyword,
'ROW_COUNT': tokens.Keyword,
'ROW_FORMAT': tokens.Keyword,
'RULE': tokens.Keyword,

'SAVE_POINT': tokens.Keyword,
Expand Down
15 changes: 15 additions & 0 deletions tests/test_regressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,21 @@ def test_primary_key_issue740():
assert p.tokens[0].ttype == T.Keyword


def test_alter_table_row_format_issue773():
# ROW_FORMAT is a keyword (like ENGINE), so it must not be absorbed into
# the preceding table name as if it were an alias.
p = sqlparse.parse('ALTER TABLE mytable ROW_FORMAT=Dynamic')[0]
row_format = p.token_next_by(m=(T.Keyword, 'ROW_FORMAT'))[1]
assert row_format is not None
Comment on lines +460 to +462
# The table name should be parsed as a standalone identifier.
assert isinstance(p.tokens[4], sql.Identifier)
assert p.tokens[4].get_real_name() == 'mytable'
assert p.tokens[4].get_alias() is None
# Sanity check: ENGINE (already a keyword) behaves the same way.
e = sqlparse.parse('ALTER TABLE mytable ENGINE=InnoDB')[0]
assert e.tokens[4].get_real_name() == 'mytable'


@pytest.fixture
def limit_recursion():
curr_limit = sys.getrecursionlimit()
Expand Down
Loading