Skip to content

show statements grammar rework#3497

Merged
sougou merged 2 commits intovitessio:masterfrom
tinyspeck:show-statements-rework
Dec 22, 2017
Merged

show statements grammar rework#3497
sougou merged 2 commits intovitessio:masterfrom
tinyspeck:show-statements-rework

Conversation

@demmer
Copy link
Copy Markdown
Member

@demmer demmer commented Dec 22, 2017

Change the way the grammar handles SHOW statements.

Instead of the previous hack which accepted any keyword or identifier following SHOW, rework the grammar to explicitly enumerate all the valid keywords but keep a catch-all for identifiers.

Also add test cases for all the valid SHOW constructs as well as the test for invalid SHOW foobar.

I pulled the set of valid statements from:
https://dev.mysql.com/doc/refman/5.7/en/show.html

This is a prerequisite for changes like #3137 or #3459.

Instead of the previous hack which accepted any keyword or identifier
following SHOW, rework the grammar to explicitly enumerate all the
valid keywords but keep a catch-all for identifiers.

Also add test cases for all the valid SHOW constructs as well as the
test for invalid `SHOW foobar`.

I pulled the set of valid statements from:
https://dev.mysql.com/doc/refman/5.7/en/show.html
Instead of defining constant strings for the various show statements
handled by vtgate, use the newly added sqlparser.KeywordString hook
to convert the token back into a string.
@demmer demmer requested a review from sougou December 22, 2017 18:18
@sougou
Copy link
Copy Markdown
Contributor

sougou commented Dec 22, 2017

LGTM

Approved with PullApprove

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants