Skip to content

fix: parse error while use NUL without quote.#34474

Merged
guanshengliang merged 9 commits intomainfrom
test/error-parse
Feb 4, 2026
Merged

fix: parse error while use NUL without quote.#34474
guanshengliang merged 9 commits intomainfrom
test/error-parse

Conversation

@xiao-77
Copy link
Copy Markdown
Contributor

@xiao-77 xiao-77 commented Feb 2, 2026

Description

Issue(s)

  • Close/close/Fix/fix/Resolve/resolve: Issue Link

Checklist

Please check the items in the checklist if applicable.

  • Is the user manual updated?
  • Are the test cases passed and automated?
  • Is there no significant decrease in test coverage?

Copilot AI review requested due to automatic review settings February 2, 2026 07:55
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @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

  • Improved Function Parsing: The parsing logic for cryptographic and encoding functions such as FROM_BASE64, TO_BASE64, MD5, SHA, SHA1, and SHA2 has been refactored. Instead of relying on generic identifier checks and string comparisons, the parser now uses dedicated token types for these functions, leading to more robust and accurate parsing.
  • New Reserved Keywords: These functions are now explicitly recognized as reserved keywords within the tokenizer. New token types (e.g., TK_FROM_BASE64, TK_MD5) have been introduced and assigned to them in the keywordTable.
  • Enhanced Value Validation: The checkAndTrimValue function, responsible for validating token types, has been updated to explicitly include these new function token types as valid values. This change prevents potential parsing errors when these functions are used in contexts requiring specific value types.

🧠 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 Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread source/libs/parser/src/parInsertSql.c Outdated
Comment thread source/libs/parser/src/parInsertSql.c Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread source/libs/parser/src/parInsertSql.c Outdated
Comment thread source/libs/parser/src/parTokenizer.c Outdated
Comment thread source/libs/parser/src/parTokenizer.c
Comment thread source/libs/parser/src/parTokenizer.c
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@xiao-77 xiao-77 requested a review from zitsen as a code owner February 3, 2026 09:27
@guanshengliang guanshengliang merged commit b491a2c into main Feb 4, 2026
18 of 21 checks passed
@minhuinie minhuinie deleted the test/error-parse branch March 4, 2026 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants