update test case and remove invalid code
This commit is contained in:
parent
ab604c18f9
commit
95a1005e1f
|
@ -755,9 +755,9 @@ static void processAlterTable(SMqMetaRsp* metaRsp, cJSON** pJson) {
|
|||
}
|
||||
|
||||
cJSON* colValue = cJSON_CreateString(buf);
|
||||
taosMemoryFree(buf);
|
||||
RAW_NULL_CHECK(colValue);
|
||||
RAW_FALSE_CHECK(cJSON_AddItemToObject(json, "colValue", colValue));
|
||||
taosMemoryFree(buf);
|
||||
}
|
||||
|
||||
cJSON* isNullCJson = cJSON_CreateBool(isNull);
|
||||
|
@ -804,9 +804,9 @@ static void processAlterTable(SMqMetaRsp* metaRsp, cJSON** pJson) {
|
|||
goto end;
|
||||
}
|
||||
cJSON* colValue = cJSON_CreateString(buf);
|
||||
taosMemoryFree(buf);
|
||||
RAW_NULL_CHECK(colValue);
|
||||
RAW_FALSE_CHECK(cJSON_AddItemToObject(member, "colValue", colValue));
|
||||
taosMemoryFree(buf);
|
||||
}
|
||||
cJSON* isNullCJson = cJSON_CreateBool(isNull);
|
||||
RAW_NULL_CHECK(isNullCJson);
|
||||
|
|
|
@ -2215,11 +2215,6 @@ static int metaUpdateTableMultiTagVal(SMeta *pMeta, int64_t version, SVAlterTbRe
|
|||
metaError("meta/table: failed to update tag idx:%s uid:%" PRId64, ctbEntry.name, ctbEntry.uid);
|
||||
}
|
||||
|
||||
if (NULL == ctbEntry.ctbEntry.pTags) {
|
||||
metaError("meta/table: null tags, update tag val failed.");
|
||||
goto _err;
|
||||
}
|
||||
|
||||
SCtbIdxKey ctbIdxKey = {.suid = ctbEntry.ctbEntry.suid, .uid = uid};
|
||||
if (tdbTbUpsert(pMeta->pCtbIdx, &ctbIdxKey, sizeof(ctbIdxKey), ctbEntry.ctbEntry.pTags,
|
||||
((STag *)(ctbEntry.ctbEntry.pTags))->len, pMeta->txn) < 0) {
|
||||
|
@ -2454,11 +2449,6 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
|
|||
metaError("meta/table: failed to update tag idx:%s uid:%" PRId64, ctbEntry.name, ctbEntry.uid);
|
||||
}
|
||||
|
||||
if (NULL == ctbEntry.ctbEntry.pTags) {
|
||||
metaError("meta/table: null tags, update tag val failed.");
|
||||
goto _err;
|
||||
}
|
||||
|
||||
SCtbIdxKey ctbIdxKey = {.suid = ctbEntry.ctbEntry.suid, .uid = uid};
|
||||
if (tdbTbUpsert(pMeta->pCtbIdx, &ctbIdxKey, sizeof(ctbIdxKey), ctbEntry.ctbEntry.pTags,
|
||||
((STag *)(ctbEntry.ctbEntry.pTags))->len, pMeta->txn) < 0) {
|
||||
|
|
|
@ -34,15 +34,30 @@ sql create table $ntable (ts timestamp, f int)
|
|||
|
||||
sql insert into $tb values(now, 1)
|
||||
sql insert into $tb values(now, 1)
|
||||
sql_error alter table $mt set tag tgcol1 = 1,tagcol2 = 2, tag3 = 4 # set tag value on supertable
|
||||
sql_error alter table $ntable set tag f = 10 # set normal table value
|
||||
sql_error alter table $tbj set tag tagCol1=1,tagCol1 = 2 # dumplicate tag name
|
||||
sql_error alter table $tbj set tag tagCol1=1,tagCol1 = 2 # not exist tag
|
||||
|
||||
# invalid sql
|
||||
sql_error alter table $mt set tag tgcol1 = 1,
|
||||
sql_error alter table $mt set tag ,
|
||||
sql_error alter table $mt set tag tgcol1=10,tagcol2=
|
||||
#set tag value on supertable
|
||||
sql_error alter table $mt set tag tgcol1 = 1,tagcol2 = 2, tag3 = 4
|
||||
#set normal table value
|
||||
sql_error alter table $ntable set tag f = 10
|
||||
# duplicate tag name
|
||||
sql_error alter table $tbj set tag tagCol1=1,tagCol1 = 2
|
||||
sql_error alter table $tbj set tag tagCol1=1,tagCol5=10, tagCol5=3
|
||||
# not exist tag
|
||||
sql_error alter table $tbj set tag tagNotExist = 1,tagCol1 = 2
|
||||
sql_error alter table $tbj set tag tagCol1 = 2, tagNotExist = 1
|
||||
sql_error alter table $tbj set tagNotExist = 1
|
||||
sql_error alter table $tbj set tagNotExist = NULL,
|
||||
sql_error alter table $tbj set tag tagCol1 = 1, tagCol5="xxxxxxxxxxxxxxxx"
|
||||
# invalid tag value
|
||||
sql_error alter table $tbj set tag tagCol1 = 1, tagCol5="xxxxxxxxxxxxxxxx", tagCol7="yyyyyyyyyyyyyyyyyyyyyyyyy"
|
||||
sql_error alter table $tbj set tag tagCol1=1,tagCol5=10, tagCol1=3
|
||||
# invalid data type
|
||||
sql_error alter table $tbj set tag tagCol5="xxxx"
|
||||
sql alter table $tbj set tag tagCol1 = 100, tagCol2 = 100
|
||||
|
||||
sql alter table $tbj set tag tagCol1 = 100, tagCol2 = 100
|
||||
|
||||
sql select * from $mt where tagCol2 = 100
|
||||
if $rows != 0 then
|
||||
|
@ -186,8 +201,9 @@ sql alter table $mt drop tag tagCol3
|
|||
|
||||
sql alter table $mt add tag tagCol8 int
|
||||
|
||||
#set not exist tag and value
|
||||
sql_error alter table $tbj set tag tagCol1=true,tagCol2=-10,tagcol3=-100, tagcol4=-1000,tagcol5=NULL,tagCol6=NULL,tagCol7=NULL
|
||||
sql_error alter table $tbj set tag tagCol1=true,tagCol2=-10,tagcol3=-100, tagcol4=-1000,tagcol5=NULL,tagCol6=NULL,tagCol7=NULL
|
||||
sql_error alter table $tbj set tag tagCol1=true,tagCol2=-10,tagcol3=-100, tagcol4=-1000,tagcol5=NULL,tagCol6=NULL,tagCol7=NULL
|
||||
|
||||
sql alter table $tbj set tag tagCol8 = 8
|
||||
|
||||
|
|
Loading…
Reference in New Issue