-
-
Notifications
You must be signed in to change notification settings - Fork 539
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
AS OF
won't parse without a FROM
clause.
#8873
Comments
@nicktobey Can you please assign this to me ? Could you provide some details on how to get started with this? |
Here's how I would get started: Our parser is a fork of Vitess and is kept in a separate repository that Dolt depends on: https://github.com/dolthub/vitess It uses yacc to generate the parsing code. The parsing grammar is all described in We have a test file The biggest challenge for this issue is probably understanding the Let me know if you have any further questions! |
Actually, I'd hang off on trying to fix it. The issue is more subtle and more complicated than I originally thought, and I'm going to discuss with the team what the best solution for this is. Basically, the reason why this gets rejected is because the But the This means that the workaround query I suggested in the first post ( Given this, allowing On the other hand, I can't think of other way to get a table hash within a query. This would mean that there's currently no way to get a table hash for branches other than the checked out branch, and maybe there should be. So @dds05, we appreciate your offer have this assigned to you, but we probably shouldn't do anything until we figure out what the correct behavior should be. |
The following is a completely valid way to get the hash of a table on a chosen branch:
SELECT DOLT_HASHOF_TABLE('table') AS OF main
However, this fails to parse with the error message:
However,
SELECT DOLT_HASHOF_TABLE('table') FROM table AS OF main
is accepted, despite the fact that table is not actually used in the query. Curiously,SELECT DOLT_HASHOF_TABLE('table') FROM dual AS OF main
is also rejected.This is likely a parsing issue in Vitess, where the grammar only matches an
AS OF
clause in the presence of aFROM
clause. (AndAS OF dual
is handled specially.)The text was updated successfully, but these errors were encountered: