未验证 提交 b64fcf74 编写于 作者: M Minglei Jin 提交者: GitHub

Merge pull request #10581 from taosdata/fix/TS-1289-D

[TS-1289]<fix>: failed to create stable if tag column was json string
......@@ -375,6 +375,8 @@ static int32_t tscGetTableTagValue(SCreateBuilder *builder, char *result) {
|| fields[i].type == TSDB_DATA_TYPE_BINARY
|| fields[i].type == TSDB_DATA_TYPE_TIMESTAMP) && 0 == ret) {
snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "\"%s\",", buf);
} else if (fields[i].type == TSDB_DATA_TYPE_JSON) {
snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "'%s,", buf);
} else {
snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "%s,", buf);
}
......@@ -382,9 +384,13 @@ static int32_t tscGetTableTagValue(SCreateBuilder *builder, char *result) {
free(buf);
if (i == num_fields - 1) {
if (fields[i].type == TSDB_DATA_TYPE_JSON) {
sprintf(result + strlen(result) - 1, "%s'", ")");
} else {
sprintf(result + strlen(result) - 1, "%s", ")");
}
}
}
if (0 == strlen(result)) {
return TSDB_CODE_TSC_INVALID_TABLE_NAME;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册