-
Notifications
You must be signed in to change notification settings - Fork 109
Improve error on nested query without aliasing #376
Comments
The mysql error is more clear: The first query is a not valid query, but the error is not clear. We are using the Vitess parser. Maybe in newer version the error is more clear. |
I guess I'm also ok with that error message if it's a MySQL standard requirement. |
Unfortunately new vitess doesn't help in this case. We still directly get:
from the yacc parser. |
Is there anything we can actually do to improve this error without manually parsing (or improving the error message on vitess)? If the error vitess' parser returns is this, there's not much we can do on our side. |
@erizocosmico I don't think so... Closing issue. |
Actually I was able to hack vitess, so this query may work ;) |
@kuba-- but the query is incorrect, at least for mysql. |
@erizocosmico - yeah, I know ^^^^
Just for curiosity ...
and generated a new sql parser I was able to query:
|
But if instead of workaround I'll add to
then we may get a nicer error:
So maybe it's worth to send yet another PR to vitess |
Not in all cases a subquery needs an alias. |
Related: vitessio/vitess#4222 |
The following query fails with a syntax error
syntax error at position 54
:When adding
sort
the error is a bit more clearunknown error: syntax error at position 62 near 'by'
:The way to fix these is to use an alias for the nested query:
This seems like a syntax bug?
The text was updated successfully, but these errors were encountered: