CalvinKirs opened a new pull request, #25587:
URL: https://github.com/apache/doris/pull/25587
### Error Context
```sql
CREATE TABLE test_create_table (
a DATEV2 NOT NULL COMMENT "a",
b VARCHAR(96) NOT NULL COMMENT 'b',
c VARCHAR(96) NOT NULL COMMENT 'c',
d VARCHAR(96) COMMENT '',
e bigint NOT NULL )
DISTRIBUTED BY HASH(e) BUCKETS 1
PROPERTIES( 'replication_num' = '1');
create table test_create_table_like like test_create_table
show create table test_create_table_like
```
``` error log
2023-10-16 11:46:39,422 WARN (mysql-nio-pool-1|298)
[StmtExecutor.handleDdlStmt():2321] DDL statement(/* ApplicationName=DataGrip
2023.1.1 */ create table test_create_table_like like test_create_table) process
failed.
org.apache.doris.common.DdlException: errCode = 2, detailMessage = Failed to
execute CREATE TABLE LIKE test_create_table. Reason: errCode = 2, detailMessage
= Syntax error in line 3:
`b` varchar(96) NOT NULL COMMENT ''b'',
^
Encountered: IDENTIFIER
Expected: COMMA
at
org.apache.doris.datasource.InternalCatalog.createTableLike(InternalCatalog.java:1187)
~[classes/:?]
at org.apache.doris.catalog.Env.createTableLike(Env.java:2878)
~[classes/:?]
at org.apache.doris.qe.DdlExecutor.execute(DdlExecutor.java:163)
~[classes/:?]
at
org.apache.doris.qe.StmtExecutor.handleDdlStmt(StmtExecutor.java:2312)
~[classes/:?]
at
org.apache.doris.qe.StmtExecutor.executeByLegacy(StmtExecutor.java:772)
~[classes/:?]
at org.apache.doris.qe.StmtExecutor.execute(StmtExecutor.java:468)
~[classes/:?]
at org.apache.doris.qe.StmtExecutor.execute(StmtExecutor.java:438)
~[classes/:?]
at
org.apache.doris.qe.ConnectProcessor.handleQuery(ConnectProcessor.java:353)
~[classes/:?]
```
### Affected version
master
### Changes
Considering that our `Comment` currently contains single quote characters,
this change will
When encapsulating `Comment`, it will be judged. If `Comment` itself already
contains single quotes, there is no need to add '.
In this way, if we directly use the `Comment` field later, we can remove the
single quotes without any impact. It is compatible with both old and new
versions.
--
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]