fix(oceanbase-oracle): COMMENT DDL use quoteStringLiteral to stop backslash doubling - #2429
Merged
openai0229 merged 4 commits intoAug 3, 2026
Conversation
…kslash doubling (OtterMind#2428) tableDDL built COMMENT ON ... IS via EasyStringUtils.escapeAndQuoteString, which doubles both ' and \. The base OracleMetaData correctly uses OracleIdentifierProcessor.quoteStringLiteral (only doubles '), and OceanBase Oracle mode treats \ as a literal, so comments containing \ were regenerated as \ and corrupted when the DDL was re-applied. Use the dialect's quoteStringLiteral, mirroring the base class. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: liuhy <liuhongyu@apache.org>
There was a problem hiding this comment.
Pull request overview
This PR fixes OceanBase (Oracle mode) DDL regeneration for table/column comments that contain backslashes by switching comment literal quoting to the dialect-correct quoteStringLiteral implementation (which only escapes single quotes, not backslashes), matching the behavior already used in the base Oracle plugin.
Changes:
- Replace
EasyStringUtils.escapeAndQuoteString(...)withOceanbaseOracleIdentifierProcessor.INSTANCE.quoteStringLiteral(...)forCOMMENT ON ... ISclauses. - Remove the now-unused
EasyStringUtilsimport.
💡 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.
The OceanBase Oracle literal handling now matches Oracle semantics: single quotes are doubled while backslashes remain literal. Added table/column DDL regression coverage; all 13 focused tests pass.
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
tableDDLbuiltCOMMENT ON ... ISviaEasyStringUtils.escapeAndQuoteString, which doubles both'and\. The baseOracleMetaDatacorrectly usesOracleIdentifierProcessor.quoteStringLiteral(only doubles'), and OceanBase Oracle mode treats\as a literal, so comments containing backslashes were regenerated as\\and corrupted when the DDL was re-applied.Location
chat2db-community-plugins/chat2db-community-oceanbase-oracle/.../OceanbaseOracleMetaData.java:52,64Fix
Use
OceanbaseOracleIdentifierProcessor.INSTANCE.quoteStringLiteral(comment)(dialect-correct, only escapes'), mirroring the baseOracleMetaData. Removed the now-unusedEasyStringUtilsimport.Verification
quoteStringLiteralis public onOracleIdentifierProcessor(line 202) and inherited byOceanbaseOracleIdentifierProcessor.Fixes #2428
🤖 Generated with Claude Code