-
-
Notifications
You must be signed in to change notification settings - Fork 513
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
[HY000][1105] Every derived table must have its own alias #8058
Comments
it seems dolt don't like the second working on dolt: SELECT SUM(found)
FROM (
SELECT 2 as found FROM dual
) as all_found; |
Thanks for reporting this one. I'm able to reproduce the error and I see that it's coming from our parser layer. Simply adding a new rule for this syntax results in a shift/reduce conflict, so we'll need to find a different way to support this. That typically either means rewriting existing rules to get rid of the conflict, or customizing the tokenizer to try and work around the conflict. I'm going to try out a few ideas, but heads up that parser conflicts can sometimes be tricky to untangle. In the meantime, do you have a workaround for this issue? Just wanted to make sure this wasn't a blocking issue. |
no blocking issue. While playing with the query from #8052 I removed the second union and find this special error. |
Fun fact: With SELECT SUM(found)
FROM (
(SELECT 1 as found FROM dual)
UNION
(SELECT 1 as found FROM dual)
) as all_found; |
I tried a few ideas today and I was able to resolve the grammar conflict, but... only if I removed part of a rule that is providing some helpful error checking. I added a new production rule to the Nice find on the SELECT SUM(found) FROM ( ( (SELECT 1 as found FROM dual) UNION (SELECT 1 as found FROM dual) ) ) as all_found;
Error parsing SQL:
Every derived table must have its own alias at position 104 near 'dual' This is a good issue for us to track as we think about how we keep evolving our SQL parser to match less commonly used MySQL syntax like this. I don't see a quick fix for enabling this syntax yet, but I've made a new tag ( Until then, if this does become a blocking issue, please comment and let us know so we can help figure out a path forward or reprioritize this one. |
Can it just resoved if there are two (or more) Then it should be equal to the MySQL syntax which allows more than two |
Thanks for the suggestion. I think we could make this syntax work with some preprocessing on the string like you mention. It may be just slightly tricky to parse, since there are cases where we can't safely reduce, but I think that's easily doable by simply checking for the correct nesting levels of the parens. My only hesitations with this approach would be that 1) it adds an additional upfront parsing step that would add extra latency for all queries, even though 99% of queries probably don't need this processing, and 2) the repeated parens are only valid in MySQL in parenthesized query expressions, and by pre-processing, we wouldn't have enough state to understand the semantics of the expression, so we'd apply this paren reduction globally in the statement, which would mean we would end up allowing these repeated parens anywhere parens are used, which would diverge from MySQL's behavior. It's not a bad idea to explore though, and I think if this does end up becoming a blocking issue for customers, then it might be our best way to work around this until we can get better modeling for parenthesized query expressions into the grammar. |
Setup
dolt as mysql server
MySQL in a Docker container
Error on Dolt
On Dolt:
Error:
MySQL
no error
The text was updated successfully, but these errors were encountered: