fix(oscar): uppercase identifier in isReservedKeyword before lookup - #2388
Merged
openai0229 merged 3 commits intoAug 3, 2026
Merged
Conversation
…tterMind#2385) isReservedKeyword looked up the identifier in the all-uppercase RESERVED_KEYWORDS set without uppercasing it first, so a lowercase or mixed-case reserved word (e.g. 'select', 'Table') returned false, leaving reserved-keyword identifiers unquoted when reached via direct SPI callers (completion/metadata paths). The bug was masked inside quoteIdentifier (which uppercases first). Match the sibling idiom (DM/SUNDB/XUGUDB): uppercase with Locale.ROOT and guard against null. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: liuhy <liuhongyu@apache.org>
There was a problem hiding this comment.
Pull request overview
Fixes Oscar dialect reserved-keyword detection so isReservedKeyword uppercases identifiers (with Locale.ROOT) before checking the all-uppercase RESERVED_KEYWORDS set, aligning behavior with other dialect processors and preventing unquoted reserved words in direct SPI call paths.
Changes:
- Add
Localeimport and uppercase reserved-keyword lookup inOscarIdentifierProcessor.isReservedKeyword. - Add a null guard to avoid NPEs on direct calls.
Findings (severity order):
chat2db-community-server/chat2db-community-plugins/chat2db-community-oscar/src/main/java/ai/chat2db/plugin/oscar/identifier/OscarIdentifierProcessor.java:29-30— Test gap: no direct unit test forisReservedKeywordcovering lowercase/mixed-case inputs andnull(onlyquoteIdentifieris exercised).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
openai0229
approved these changes
Aug 3, 2026
openai0229
left a comment
Contributor
There was a problem hiding this comment.
Verified on the latest main. Reserved keyword lookup is Locale.ROOT case-insensitive and null-safe; the focused Oscar suite ran 25 tests with 0 failures.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
OscarIdentifierProcessor.isReservedKeywordlooked up the identifier in the all-uppercaseRESERVED_KEYWORDSset without uppercasing it first, so a lowercase or mixed-case reserved word (e.g.select,Table) returnedfalse. Direct SPI callers (completion/metadata paths) then left reserved-keyword identifiers unquoted. The bug was masked insidequoteIdentifier(which uppercases before delegating).Location
chat2db-community-plugins/chat2db-community-oscar/src/main/java/ai/chat2db/plugin/oscar/identifier/OscarIdentifierProcessor.java:27-30Fix
Match the sibling idiom used by
DMIdentifierProcessor,SUNDBIdentifierProcessor, andXugudbIdentifierProcessor: uppercase withLocale.ROOTand guard againstnull.(
import java.util.Locale;added.)Verification
OscarIdentifierProcessorTestshould still pass; a lowercase reserved word now returnstrue.Fixes #2385
🤖 Generated with Claude Code