-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sql: SELECT ("*") parse oddities #1810
Comments
very much related to cockroachdb#1810.
fixes, e.g., parsing of 1e-/*test*/-5. very much related to cockroachdb#1810.
fixes, e.g., parsing of 1e-/*test*/-5. very much related to cockroachdb#1810.
I've tried to get to the bottom of this, but it's rabbit hole-ish. Basically the issue is that we have Maybe ping @petermattis |
This isn't so much the grammar (which is parsing things fine), but the generated syntax tree. |
something like this? type QualifiedName interface {
qualifiedName()
}
// with implementers:
type StarExpr struct {
NonStarExpr // by convention, with Column() = ""
}
type NonStarExpr {
// holds and exposes database, table, column
} |
I don't think this is sufficient. This is an area of the postgres grammar that was significantly more complex than the vitess grammar. See the Seems like
|
this is the only useful (?) part of my attempts at cockroachdb#1810.
QualifiedName is now composed of a base name and an indirection expression. Elements in an indirection expression are either ".<name>", ".*" or "[<begin>:<end>]". Fixes #1810.
QualifiedName is now composed of a base name and an indirection expression. Elements in an indirection expression are either ".<name>", ".*" or "[<begin>:<end>]". Fixes #1810.
SELECT ("*")
reproduces asSELECT (*)
, which isn't valid SQL.On the other hand,
SELECT FROM t WHERE a = COUNT(*)
is valid SQL.In both cases,
*
is aQualifiedName{"a"}
but for the first, the correspondingString()
must be"*"
(not*
).I've looked around for an obvious fix for this, but I'm thinking this is something that should be done at the grammar level by having
*
as a keyword of some sorts.this, again, found by fuzzing. ping @dvyukov.
edit: even easier:
SELECT "*"
->SELECT *
.The text was updated successfully, but these errors were encountered: