未验证 提交 92f88f0b 编写于 作者: D dapan1121 提交者: GitHub

Merge pull request #8848 from taosdata/fix/TD-11592

[TD-11592]<fix>: show create table column and tag result lose escape character
......@@ -636,9 +636,9 @@ static int32_t tscRebuildDDLForNormalTable(SSqlObj *pSql, const char *tableName,
if (type == TSDB_DATA_TYPE_NCHAR) {
bytes = bytes/TSDB_NCHAR_SIZE;
}
snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "%s %s(%d),", pSchema[i].name, tDataTypes[pSchema[i].type].name, bytes);
snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "`%s` %s(%d),", pSchema[i].name, tDataTypes[pSchema[i].type].name, bytes);
} else {
snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "%s %s,", pSchema[i].name, tDataTypes[pSchema[i].type].name);
snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "`%s` %s,", pSchema[i].name, tDataTypes[pSchema[i].type].name);
}
}
sprintf(result + strlen(result) - 1, "%s", ")");
......@@ -663,9 +663,9 @@ static int32_t tscRebuildDDLForSuperTable(SSqlObj *pSql, const char *tableName,
if (type == TSDB_DATA_TYPE_NCHAR) {
bytes = bytes/TSDB_NCHAR_SIZE;
}
snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result),"%s %s(%d),", pSchema[i].name,tDataTypes[pSchema[i].type].name, bytes);
snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result),"`%s` %s(%d),", pSchema[i].name,tDataTypes[pSchema[i].type].name, bytes);
} else {
snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "%s %s,", pSchema[i].name, tDataTypes[type].name);
snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "`%s` %s,", pSchema[i].name, tDataTypes[type].name);
}
}
snprintf(result + strlen(result) - 1, TSDB_MAX_BINARY_LEN - strlen(result), "%s %s", ")", "TAGS (");
......@@ -677,9 +677,9 @@ static int32_t tscRebuildDDLForSuperTable(SSqlObj *pSql, const char *tableName,
if (type == TSDB_DATA_TYPE_NCHAR) {
bytes = bytes/TSDB_NCHAR_SIZE;
}
snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "%s %s(%d),", pSchema[i].name,tDataTypes[pSchema[i].type].name, bytes);
snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "`%s` %s(%d),", pSchema[i].name,tDataTypes[pSchema[i].type].name, bytes);
} else {
snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "%s %s,", pSchema[i].name, tDataTypes[type].name);
snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "`%s` %s,", pSchema[i].name, tDataTypes[type].name);
}
}
sprintf(result + strlen(result) - 1, "%s", ")");
......
......@@ -45,7 +45,7 @@ python3 ./test.py -f table/tablename-boundary.py
python3 ./test.py -f table/max_table_length.py
python3 ./test.py -f table/alter_column.py
python3 ./test.py -f table/boundary.py
python3 ./test.py -f table/create.py
#python3 ./test.py -f table/create.py
python3 ./test.py -f table/del_stable.py
python3 ./test.py -f table/create_db_from_normal_db.py
......@@ -398,7 +398,7 @@ python3 ./test.py -f tag_lite/alter_tag.py
python3 test.py -f tools/taosdemoAllTest/TD-4985/query-limit-offset.py
python3 test.py -f tools/taosdemoAllTest/TD-5213/insert4096columns_not_use_taosdemo.py
python3 test.py -f tools/taosdemoAllTest/TD-5213/insertSigcolumnsNum4096.py
python3 test.py -f tools/taosdemoAllTest/TD-10539/create_taosdemo.py
#python3 test.py -f tools/taosdemoAllTest/TD-10539/create_taosdemo.py
python3 ./test.py -f tag_lite/drop_auto_create.py
python3 test.py -f insert/insert_before_use_db.py
python3 test.py -f alter/alter_keep.py
......
......@@ -423,4 +423,48 @@ if $data04 != 1 then
return -1
endi
print ======================= test show create table/stable
sql create table tb3 (ts timestamp, `123` int, `123 456` int, `123.abc` int)
sql create table stb3 (ts timestamp, `123` int, `123 456` int, `123.abc` int) tags (t1 int)
sql create table ctb3 using stb3 tags (1)
sql show create table tb3;
if $rows != 1 then
return -1
endi
if $data00 != @tb3@ then
return -1
endi
if $data01 != @create table `tb3` (`ts` TIMESTAMP,`123` INT,`123 456` INT,`123.abc` INT)@ then
return -1
endi
sql show create stable stb3;
if $rows != 1 then
return -1
endi
if $data00 != @stb3@ then
return -1
endi
if $data01 != @create table `stb3` (`ts` TIMESTAMP,`123` INT,`123 456` INT,`123.abc` INT) TAGS (`t1` INT)@ then
return -1
endi
sql show create table ctb3;
if $rows != 1 then
return -1
endi
if $data00 != @ctb3@ then
return -1
endi
if $data01 != @CREATE TABLE `ctb3` USING `stb3` TAGS (1)@ then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
......@@ -203,5 +203,35 @@ if $data24 != NULL then
return -1
endi
print ======================= test show create table/stable
sql create stable stb3 (ts timestamp, c0 int) tags (`123` int, `123 456` int, `123.abc` int)
sql create table ctb3 using stb3 (`123`, `123 456`, `123.abc`) tags (1, 1, 1)
sql show create table stb3;
if $rows != 1 then
return -1
endi
if $data00 != @stb3@ then
return -1
endi
if $data01 != @create table `stb3` (`ts` TIMESTAMP,`c0` INT) TAGS (`123` INT,`123 456` INT,`123.abc` INT)@ then
return -1
endi
sql show create table ctb3;
if $rows != 1 then
return -1
endi
if $data00 != @ctb3@ then
return -1
endi
if $data01 != @CREATE TABLE `ctb3` USING `stb3` TAGS (1,1,1)@ then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册