提交 4856586f 编写于 作者: wmmhello's avatar wmmhello

TD-6129<feature> add json type check

上级 3de234a2
......@@ -6074,7 +6074,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
}
if(pItem->pVar.nType != TSDB_DATA_TYPE_BINARY){
tscError("json type error, should be string");
return invalidOperationMsg(pMsg, "json type error, should be string");
return invalidOperationMsg(pMsg, msg25);
}
code = parseJsontoTagData(pItem->pVar.pz, &kvRowBuilder, pMsg, pTagsSchema->colId);
if (code != TSDB_CODE_SUCCESS) {
......@@ -7698,7 +7698,7 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
tVariantListItem* pItem = taosArrayGet(pValList, 0);
if(pItem->pVar.nType != TSDB_DATA_TYPE_BINARY){
tscError("json type error, should be string");
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), "json type error, should be string");
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg6);
}
ret = parseJsontoTagData(pItem->pVar.pz, &kvRowBuilder, tscGetErrorMsgPayload(pCmd), pTagSchema[0].colId);
if (ret != TSDB_CODE_SUCCESS) {
......
......@@ -34,8 +34,12 @@ class TDTestCase:
"create table if not exists db_json_tag_test.jsons1(ts timestamp, dataInt int, dataStr nchar(50)) tags(jtag json)")
tdSql.execute(
"CREATE TABLE if not exists db_json_tag_test.jsons1_1 using db_json_tag_test.jsons1 tags('{\"loc\":\"fff\",\"id\":5}')")
tdSql.execute(
"CREATE TABLE if not exists db_json_tag_test.jsons1_3 using db_json_tag_test.jsons1 tags(3333)")
tdSql.execute(
"insert into jsons1_2 using db_json_tag_test.jsons1 tags('{\"num\":5,\"location\":\"beijing\"}' values (now, 1, 'sss')")
tdSql.execute(
"insert into jsons1_4 using db_json_tag_test.jsons1 tags(3)")
print("==============step2")
tdLog.info("select table")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册