From 873ab6d97fc5228eed415b116040e81d9d4d251e Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Tue, 30 Nov 2021 15:12:49 +0800 Subject: [PATCH] [TD-11584]invalid sql can be executed successfully --- src/query/src/qSqlParser.c | 4 ++++ tests/pytest/table/create.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/query/src/qSqlParser.c b/src/query/src/qSqlParser.c index de80a29a8c..e465284244 100644 --- a/src/query/src/qSqlParser.c +++ b/src/query/src/qSqlParser.c @@ -744,6 +744,10 @@ void tSetColumnType(TAOS_FIELD *pField, SStrToken *type) { pField->bytes = (int16_t)bytes; } + } else { + if (type->type > 0) { + pField->type = -1; + } } } diff --git a/tests/pytest/table/create.py b/tests/pytest/table/create.py index 54e821246c..51277f28e0 100644 --- a/tests/pytest/table/create.py +++ b/tests/pytest/table/create.py @@ -28,6 +28,8 @@ class TDTestCase: print("==============step1") print("prepare data") + tdSql.error("create table db.st1 (ts timestamp(8), i int) tags(j int)") + tdSql.error("create table db.st2 (ts timestamp, i int(2)) tags(j int)") tdSql.execute("create table db.st (ts timestamp, i int) tags(j int)") tdSql.execute("create table db.tb using st tags(1)") tdSql.execute("insert into db.tb values(now, 1)") -- GitLab