SkylerLin created FLINK-39833:
---------------------------------

             Summary: Special characters in column comment and default value 
are not escaped when building DDL
                 Key: FLINK-39833
                 URL: https://issues.apache.org/jira/browse/FLINK-39833
             Project: Flink
          Issue Type: Bug
          Components: Flink CDC
    Affects Versions: cdc-3.6.0
            Reporter: SkylerLin
             Fix For: cdc-3.6.0, cdc-3.7.0


When the StarRocks pipeline connector builds DDL statements (CREATE TABLE / 
ALTER TABLE ADD COLUMN), special characters in column comments and default 
values (such as backslash `\`, double quote `"`, newline `\n`, carriage return 
`\r`) are not properly escaped.

This causes the generated DDL to be syntactically invalid, leading to schema 
synchronization failures at runtime.

*Root Cause:*

The column comment and default value strings are directly interpolated into the 
DDL template `DEFAULT "..."` and `COMMENT "..."` without any escaping.

*Fix:*

Introduce a utility method `StarRocksUtils.escapeSqlStringLiteral()` that 
escapes:
- `\` → `\\`
- `"` → `""`
- `\n` / `\r` → space



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to