From cffb8cfa1d22ceec78093a20412ca348e5c9e27f Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Thu, 23 Sep 2021 14:17:43 +0800 Subject: [PATCH] [TD-10438]: OpenTSDB duplicated JSON ids should return error --- src/client/src/tscParseOpenTSDB.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/client/src/tscParseOpenTSDB.c b/src/client/src/tscParseOpenTSDB.c index 14693ae361..48c979306b 100644 --- a/src/client/src/tscParseOpenTSDB.c +++ b/src/client/src/tscParseOpenTSDB.c @@ -831,10 +831,12 @@ int32_t parseTagsFromJSON(cJSON *root, TAOS_SML_KV **pKVs, int *num_kvs, char ** } *childTableName = tcalloc(idLen + 1, sizeof(char)); memcpy(*childTableName, id->valuestring, idLen); - //remove all ID fields from tags list no case sensitive - while (id != NULL) { - cJSON_DeleteItemFromObject(tags, "ID"); - id = cJSON_GetObjectItem(tags, "ID"); + + //If there's duplicate ID fields in tags return error + cJSON_DeleteItemFromObject(tags, "ID"); + id = cJSON_GetObjectItem(tags, "ID"); + if (id != NULL) { + return TSDB_CODE_TSC_DUP_TAG_NAMES; } } -- GitLab