fix: parse error while use NUL without quote.#34474
Conversation
Summary of ChangesHello @xiao-77, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a parsing error that could occur when certain cryptographic and encoding functions were used without quotes. By promoting these functions to dedicated token types and updating the parser and tokenizer to recognize them as reserved keywords, the changes significantly enhance the robustness and correctness of SQL parsing, particularly in scenarios where these functions are treated as values. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors the parsing of several SQL functions to use specific tokens instead of generic identifiers and string comparisons. This is a positive change for code clarity and performance. However, the current implementation introduces two critical regressions that break existing functionality for other functions like aes_encrypt and sm4_encrypt. I've identified these issues and provided suggestions for fixing them.
There was a problem hiding this comment.
Pull request overview
This PR refactors the parser to add new keyword tokens (FROM_BASE64, TO_BASE64, MD5, SHA, SHA1, SHA2) and replaces string-based comparisons with token type checks for these encoding and hashing functions in INSERT statement parsing. However, the PR title "fix: parse error while use NUL without quote" does not accurately describe these changes.
Changes:
- Added six new keywords to the parser's keyword table (FROM_BASE64, TO_BASE64, MD5, SHA, SHA1, SHA2)
- Modified parseBinary() function to check for specific token types instead of using string comparisons
- Updated checkAndTrimValue() to accept the new token types as valid values
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| source/libs/parser/src/parTokenizer.c | Added six new keyword entries (FROM_BASE64, TO_BASE64, MD5, SHA, SHA1, SHA2) to the keyword table |
| source/libs/parser/src/parInsertSql.c | Replaced string comparisons with token type checks in parseBinary() and updated checkAndTrimValue() to accept new token types |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
… into test/error-parse
… into test/error-parse
Description
Issue(s)
Checklist
Please check the items in the checklist if applicable.