From bd06b430595bf5a802cae6426904185625a4aa44 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 16 Jun 2021 18:07:03 +0800 Subject: [PATCH] [TD-3086] tag support timestamp --- src/client/src/tscSQLParser.c | 4 ++-- tests/script/general/parser/create_mt.sim | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 8c14394219..ea1e50e72c 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -8029,7 +8029,7 @@ int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSqlExpr* pS tVariantAssign((*pExpr)->pVal, &pSqlExpr->value); STableMeta* pTableMeta = tscGetMetaInfo(pQueryInfo, 0)->pTableMeta; - if (pCols != NULL) { + if (pCols != NULL && taosArrayGetSize(pCols) > 0) { SColIndex* idx = taosArrayGet(pCols, 0); SSchema* pSchema = tscGetTableColumnSchema(pTableMeta, idx->colIndex); // convert time by precision @@ -8094,7 +8094,7 @@ int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSqlExpr* pS } else if (pSqlExpr->tokenId == TK_SET) { int32_t colType = -1; STableMeta* pTableMeta = tscGetMetaInfo(pQueryInfo, 0)->pTableMeta; - if (pCols != NULL) { + if (pCols != NULL && taosArrayGetSize(pCols) > 0) { SColIndex* idx = taosArrayGet(pCols, 0); SSchema* pSchema = tscGetTableColumnSchema(pTableMeta, idx->colIndex); if (pSchema != NULL) { diff --git a/tests/script/general/parser/create_mt.sim b/tests/script/general/parser/create_mt.sim index ae1629dce9..c606ba99ec 100644 --- a/tests/script/general/parser/create_mt.sim +++ b/tests/script/general/parser/create_mt.sim @@ -99,7 +99,7 @@ $i_binary2 = varchar(20) # illegal string $i_bool = boolean $nchar = nchar # nchar with unspecified length print ========== create_mt.sim case4: illegal data types in tags test -sql_error create table $mt (ts timestamp, col int) tags (tag1 timestamp ) +##sql_error create table $mt (ts timestamp, col int) tags (tag1 timestamp ) sql_error create table $mt (ts timestamp, col int) tags (tag1 $i_ts ) sql_error create table $mt (ts timestamp, col int) tags (tag1 $i_binary ) sql_error create table $mt (ts timestamp, col int) tags (tag1 $i_bigint ) @@ -253,4 +253,4 @@ if $rows != 0 then return -1 endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT