-
Notifications
You must be signed in to change notification settings - Fork 567
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
SHOW
statements silently dropping quoted strings
#616
Comments
Could you please specify the dialect in which you are based on? |
Thanks Augusto, The model I have tried to follow for this feature is SHOW VARIABLES from Trino and I recently submitted a PR to add this command. Trino / Presto isn't a specific dialect on sqlparser-rs, I am using the MySQL dialect. I think it's a bug that the tokens are silently dropped, and although I would find it useful if the tokens are returned in the AST, I appreciate this somewhat non-standard. |
@joocer is this still required? It seems like had a merge already. What's the status? Can I give any help? |
Hi Augusto, the PR was to solve the specific use case I had for a I have experience in multiple other languages to have been able to find the pattern in the existing code I could replicate to add |
When parsing generic
SHOW
statements such asSHOW FUNCTIONS
orSHOW PARAMETERS
, the parser creates aShowVariable
AST with each of the tokens afterSHOW
added as avariable
node. This should allow functionality likeSHOW FUNCTIONS LIKE '%date%'
to be written by processing the AST even if the lexer doesn't understand what the query means.However, this query
SHOW FUNCTIONS LIKE '%date%'
is parser to:Where the value in quotes is removed.
I think this is probably because
SHOW
queries, not followed by a well-known token (e.g.SHOW VARIABLES
,SHOW COLUMNS
) defaults to a variation ofSHOW VARIABLE
, and the tokens afterwards are expected to be formatted like Identifiers, but a quoted string doesn't match this expectation. If that is the case, I expect an error to be raised rather than silently dropping part of the query.Thanks
The text was updated successfully, but these errors were encountered: