Skip to content

fix(oceanbase-oracle): COMMENT DDL use quoteStringLiteral to stop backslash doubling - #2429

Merged
openai0229 merged 4 commits into
OtterMind:mainfrom
Aias00:fix/oceanbase-oracle-comment-backslash-2428
Aug 3, 2026
Merged

openai0229 merged 4 commits into
OtterMind:mainfrom
Aias00:fix/oceanbase-oracle-comment-backslash-2428

Conversation

@Aias00

@Aias00 Aias00 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

What

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 backslashes were regenerated as \\ and corrupted when the DDL was re-applied.

Location

chat2db-community-plugins/chat2db-community-oceanbase-oracle/.../OceanbaseOracleMetaData.java:52,64

Fix

Use OceanbaseOracleIdentifierProcessor.INSTANCE.quoteStringLiteral(comment) (dialect-correct, only escapes '), mirroring the base OracleMetaData. Removed the now-unused EasyStringUtils import.

Verification

  • quoteStringLiteral is public on OracleIdentifierProcessor (line 202) and inherited by OceanbaseOracleIdentifierProcessor.
  • Recommended: regenerate DDL for an OceanBase Oracle table whose comment contains a backslash — the comment must round-trip without doubling.

Fixes #2428

🤖 Generated with Claude Code

…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>
Copilot AI review requested due to automatic review settings August 3, 2026 12:34
@Aias00
Aias00 requested a review from openai0229 as a code owner August 3, 2026 12:34

Copilot AI left a comment

Copy link
Copy Markdown

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 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(...) with OceanbaseOracleIdentifierProcessor.INSTANCE.quoteStringLiteral(...) for COMMENT ON ... IS clauses.
  • Remove the now-unused EasyStringUtils import.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@openai0229 openai0229 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@openai0229
openai0229 merged commit 68e26c6 into OtterMind:main Aug 3, 2026
15 of 16 checks passed
@openai0229 openai0229 moved this from In Review to Done in Chat2DB Community Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

bug(oceanbase-oracle): COMMENT DDL doubles backslashes (regression vs base Oracle)

3 participants