DO12345whatever opened a new issue, #39178: URL: https://github.com/apache/doris/issues/39178
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no similar issues. ### Version 2.1.5 ### What's Wrong? Using escaped single quotes or other escaped characters in a comment of a table creation makes it impossible to `CREATE new_table LIKE old_table` and the `SHOW CREATE old_table` statement is syntactically incorrect ### What You Expected? escape characters inside a comment string literal should be preserved, making `SHOW CREATE table` copy-pasteable and `CREATE new_table LIKE old_table` work without syntax errors ### How to Reproduce? Step 1, create a simple table with a comment containing a single quote or any other escaped character like \n or \t ```sql CREATE TABLE `broken_comment` ( `id` VARCHAR(1024) NULL COMMENT 'Identifier', `comment` VARCHAR(1024) NULL COMMENT 'The rows\'s comment', ) DUPLICATE KEY(`id`) DISTRIBUTED BY RANDOM BUCKETS AUTO ``` -- Step 2, note the invalid syntax due to the missing escape character which causes issues if copypasting the statement. Even worse, whitespace \n and \t would be turned into simple letters n and t ```sql SHOW CREATE TABLE `broken_comment`; CREATE TABLE `broken_comment` ( `id` VARCHAR(1024) NULL COMMENT 'Identifier', `comment` VARCHAR(1024) NULL COMMENT 'The rows's comment' ) ENGINE=OLAP DUPLICATE KEY(`id`) DISTRIBUTED BY RANDOM BUCKETS AUTO PROPERTIES ( "replication_allocation" = "tag.location.default: 3", "min_load_replica_num" = "-1", "is_being_synced" = "false", "storage_medium" = "hdd", "storage_format" = "V2", "inverted_index_storage_format" = "V1", "light_schema_change" = "true", "disable_auto_compaction" = "false", "enable_single_replica_compaction" = "false", "group_commit_interval_ms" = "10000", "group_commit_data_bytes" = "134217728" ); ``` -- Step 3, try duplicating the table for testing purposes ```sql CREATE TABLE copy_table LIKE broken_comment; -- results in the following error Execution failed: Error Failed to execute sql: java.sql.SQLException: (conn=65171) errCode = 2, detailMessage = Failed to execute CREATE TABLE LIKE broken_comment. Reason: errCode = 2, detailMessage = Syntax error in line 3: `comment` VARCHAR(1024) NULL COMMENT 'The rows's comment' ^ Encountered: IDENTIFIER Expected: COMMA ``` ### Anything Else? _No response_ ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- 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]
