Skip to content

Commit 36f409c

Browse files
sqlparser: reject unqualified * after comma in SELECT list
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>
1 parent 51e14b9 commit 36f409c

File tree

6 files changed

+749
-739
lines changed

6 files changed

+749
-739
lines changed

go/vt/sqlparser/parse_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6633,6 +6633,12 @@ var invalidSQL = []struct {
66336633
}, {
66346634
input: "insert into t1 (a1) values row('a'), ('b')",
66356635
output: "syntax error at position 39",
6636+
}, {
6637+
input: "select a, * from t",
6638+
output: "syntax error: unexpected '*' at position 12",
6639+
}, {
6640+
input: "select *, * from t",
6641+
output: "syntax error: unexpected '*' at position 12",
66366642
}}
66376643

66386644
func TestErrors(t *testing.T) {

0 commit comments

Comments
 (0)