vtgate: Reject unqualified * after comma in SELECT list#19475
Open
arthurschreiber wants to merge 2 commits intomainfrom
Open
vtgate: Reject unqualified * after comma in SELECT list#19475arthurschreiber wants to merge 2 commits intomainfrom
* after comma in SELECT list#19475arthurschreiber wants to merge 2 commits intomainfrom
Conversation
Contributor
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
* after comma in SELECT list
Contributor
|
📝 Documentation updates detected! New suggestion: Document SELECT expression syntax rules for * wildcard Tip: Tag @Promptless in GitHub PR comments to guide documentation changes during code review 🐙 |
Member
Author
|
I dismissed Promptless' documentation suggestion, because I don't think we need to document behavior where Vitess and MySQL match (because that should be the "default" behavior). |
MySQL only allows unqualified `*` as the first expression in a SELECT list. After a comma, only qualified `table.*` is permitted. Add a check in the `select_expression_list` grammar rule to reject unqualified `*` when it appears after a comma, matching MySQL behavior. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Arthur Schreiber <arthur@planetscale.com>
0b45ea6 to
36f409c
Compare
Update two plan test cases that used unqualified `*` after a comma, which is now rejected at parse time. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Arthur Schreiber <arthur@planetscale.com>
This was referenced Feb 26, 2026
Closed
Closed
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.
Description
MySQL only allows unqualified
*as the first expression in a SELECT list. After a comma, only qualifiedtable.*is permitted (e.g.SELECT a, t.* FROM tis fine, butSELECT a, * FROM tis a syntax error). The Vitess parser accepted*in any position, diverging from MySQL behavior.This adds a check in the
select_expression_listgrammar rule to reject unqualified*when it appears after a comma.MySQL behavior reference:
SELECT * FROM tSELECT *, a FROM tSELECT a, t.* FROM tSELECT t.*, t.* FROM tSELECT a, * FROM tSELECT *, * FROM tNote
This means that some queries that worked in Vitess previously might fail after this change.
This is only relevant for queries targeting tables in sharded keyspaces due to the automatic expansion of unqualified
*expressions.Queries against unsharded keyspaces would have failed even before this fix once they reached MySQL.
Related Issue(s)
N/A
Checklist
Deployment Notes
N/A
AI Disclosure
Most of this PR was written by Claude Code.