morrySnow opened a new pull request, #67708: URL: https://github.com/apache/doris/pull/67708
## Problem `SHOW CREATE VIEW` inserted view comments directly between single quotes. A comment containing an apostrophe produced invalid, non-replayable DDL. ## Root cause Both view DDL construction paths appended the stored comment text without applying SQL string-literal escaping. For example, the comment `O'Reilly` was emitted as `COMMENT 'O'Reilly'`, where the apostrophe prematurely ended the literal. ## How to reproduce ```sql CREATE VIEW v COMMENT "O'Reilly" AS SELECT 1 AS c; SHOW CREATE VIEW v; ``` Before this change, replaying the returned `CREATE VIEW` statement failed because its comment literal was malformed. ## Fix Centralize view-comment rendering in a shared helper used by both DDL generation paths. Comments containing apostrophes or backslashes are passed to `SqlUtils.quoteStringLiteral` with the active `NO_BACKSLASH_ESCAPES` mode, so the resulting literal is valid for the current SQL mode. Comments that require no escaping keep the existing single-quoted output format. The unit test exports a view whose comment contains an apostrophe, replays the exported DDL under a new view name, and verifies that the comment is preserved exactly. ## Tests - `./run-fe-ut.sh --run CreateViewTest`: 10 tests passed, 0 failures - `./build.sh --fe`: all 73 FE modules built successfully - Manual sandbox validation confirmed that `SHOW CREATE VIEW` emits `COMMENT "O'Reilly"` and the exported statement is replayable -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
