fix(mysql): support SHOW TABLES IN <schema> parsing#7537
Open
mkcorneli wants to merge 1 commit intotobymao:mainfrom
Open
fix(mysql): support SHOW TABLES IN <schema> parsing#7537mkcorneli wants to merge 1 commit intotobymao:mainfrom
mkcorneli wants to merge 1 commit intotobymao:mainfrom
Conversation
MariaDB and MySQL both accept `SHOW TABLES IN schema` as a synonym for `SHOW TABLES FROM schema`, but the parser only handled `FROM`. The `IN` token was being consumed as a potential log-file specifier (for BINLOG/RELAYLOG EVENTS) and then lost, leaving the schema identifier unconsumed and raising a ParseError. Save the parser index before consuming `IN`; if no string literal follows, retreat so the schema-name branch can match `IN` as an alias for `FROM`. BINLOG/RELAYLOG EVENTS behavior is preserved by the existing test_show_events coverage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MariaDB and MySQL both accept
SHOW TABLES IN schemaas a synonym forSHOW TABLES FROM schema, but the parser only handledFROM. This PR teaches_parse_show_mysqlto also acceptINas a schema-name alias without breaking the existing log-file handling forSHOW BINLOG EVENTS IN 'logfile'.Before
After
Why it broke
The
INtoken was being consumed unconditionally as a potential log-file specifier. When followed by an identifier (e.g.test) rather than a string literal,_parse_string()returnedNonebutINwas already consumed — leaving the schema identifier as an unexpected token.Fix
Save the parser index before consuming
IN; if no string literal follows,_retreat(index)so the schema-name branch can matchINas an alias forFROM. BINLOG/RELAYLOG EVENTS behavior is preserved because those variants always have a string literal followingIN.Test plan
test_show_tablescoverSHOW TABLES IN testandSHOW FULL TABLES IN testround-tripstest_show_events(line 1175) still passes — confirmsSHOW BINLOG EVENTS IN 'log' FROM 1 LIMIT 2, 3regression guardtests/dialects/suite runs cleanly (no new failures vs. main)ruff check+ruff format --checkpass