From 0d566d17b5b128b5466fab9625c8b498f4fcb006 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 28 Feb 2022 18:56:51 +0800 Subject: [PATCH] [td-13748] fix bug. --- source/client/test/clientTests.cpp | 2 +- source/libs/parser/src/dCDAstProcess.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/source/client/test/clientTests.cpp b/source/client/test/clientTests.cpp index 276c19538c..7bba093588 100644 --- a/source/client/test/clientTests.cpp +++ b/source/client/test/clientTests.cpp @@ -334,7 +334,7 @@ TEST(testCase, create_ctable_Test) { } taos_free_result(pRes); - pRes = taos_query(pConn, "create table tm0 using st1 tags(1)"); + pRes = taos_query(pConn, "create table tu using sts tags('2021-10-10 1:1:1');"); if (taos_errno(pRes) != 0) { printf("failed to create child table tm0, reason:%s\n", taos_errstr(pRes)); } diff --git a/source/libs/parser/src/dCDAstProcess.c b/source/libs/parser/src/dCDAstProcess.c index b4125b0a24..6131d50c12 100644 --- a/source/libs/parser/src/dCDAstProcess.c +++ b/source/libs/parser/src/dCDAstProcess.c @@ -260,8 +260,11 @@ static int32_t doParseSerializeTagValue(SSchema* pTagSchema, int32_t numOfInputT SKvParam param = {.builder = pKvRowBuilder, .schema = pSchema}; SToken* pItem = taosArrayGet(pTagValList, i); - code = parseValueToken(&endPtr, pItem, pSchema, tsPrecision, tmpTokenBuf, KvRowAppend, ¶m, pMsgBuf); + if (pSchema->type == TSDB_DATA_TYPE_TIMESTAMP && pItem->z[0] == '\'') { + pItem->z += 1; + } + code = parseValueToken(&endPtr, pItem, pSchema, tsPrecision, tmpTokenBuf, KvRowAppend, ¶m, pMsgBuf); if (code != TSDB_CODE_SUCCESS) { return buildInvalidOperationMsg(pMsgBuf, msg1); }