From 843ecffc6628e6e16bc55f9eca1408849633957d Mon Sep 17 00:00:00 2001 From: Chris Zhai Date: Tue, 19 Mar 2024 19:19:25 +0800 Subject: [PATCH 1/4] add test cases for ts-4211 - v1 --- tests/pytest/util/sql.py | 3 + .../1-insert/insert_column_value.py | 155 +++++++++++++----- 2 files changed, 118 insertions(+), 40 deletions(-) diff --git a/tests/pytest/util/sql.py b/tests/pytest/util/sql.py index 92074161b6..7ccb290d62 100644 --- a/tests/pytest/util/sql.py +++ b/tests/pytest/util/sql.py @@ -85,6 +85,7 @@ class TDSql: i=1 while i <= queryTimes: try: + tdLog.info(sql) self.affectedRows = self.cursor.execute(sql) return self.affectedRows except Exception as e: @@ -120,8 +121,10 @@ class TDSql: expectErrNotOccured = True try: + tdLog.info("sql:%s" % (sql)) self.cursor.execute(sql) except BaseException as e: + tdLog.info("err:%s" % (e)) expectErrNotOccured = False self.errno = e.errno error_info = repr(e) diff --git a/tests/system-test/1-insert/insert_column_value.py b/tests/system-test/1-insert/insert_column_value.py index 49b77f4199..73d9aaeeda 100644 --- a/tests/system-test/1-insert/insert_column_value.py +++ b/tests/system-test/1-insert/insert_column_value.py @@ -1,4 +1,4 @@ -import datetime +import datetime, time from enum import Enum from util.log import * from util.sql import * @@ -55,14 +55,30 @@ class TDTestCase: f"create table {dbname}.stb_in (ts timestamp, c0 int, c1 smallint) tags(t0 bigint, t1 tinyint);", f"create table {dbname}.stb_ui (ts timestamp, c0 int unsigned, c1 smallint unsigned) tags(t0 bigint unsigned, t1 tinyint unsigned);", f"create table {dbname}.stb_fl (ts timestamp, c0 float, c1 float) tags(t0 float, t1 float);", - f"create table {dbname}.stb_db (ts timestamp, c0 float, c1 float) tags(t0 float, t1 float);", + f"create table {dbname}.stb_db (ts timestamp, c0 double, c1 double) tags(t0 double, t1 double);", f"create table {dbname}.stb_ge (ts timestamp, c0 geometry(512), c1 geometry(512)) tags(t0 geometry(512), t1 geometry(512));", - f"create table {dbname}.stb_js (ts timestamp, c0 int) tags(t0 json);" ] + f"create table {dbname}.stb_js (ts timestamp, c0 int) tags(t0 json);"] + + CREATE_NTB_LIST = [ f"create table {dbname}.ntb_vc (ts timestamp, c0 binary(50), c1 varchar(50));", + f"create table {dbname}.ntb_nc (ts timestamp, c0 nchar(50), c1 nchar(50));", + f"create table {dbname}.ntb_ts (ts timestamp, c0 timestamp, c1 timestamp);", + f"create table {dbname}.ntb_bo (ts timestamp, c0 bool, c1 bool);", + f"create table {dbname}.ntb_vb (ts timestamp, c0 varbinary(50), c1 varbinary(50));", + f"create table {dbname}.ntb_in (ts timestamp, c0 int, c1 smallint);", + f"create table {dbname}.ntb_ui (ts timestamp, c0 int unsigned, c1 smallint unsigned);", + f"create table {dbname}.ntb_fl (ts timestamp, c0 float, c1 float);", + f"create table {dbname}.ntb_db (ts timestamp, c0 double, c1 double);", + f"create table {dbname}.ntb_ge (ts timestamp, c0 geometry(512), c1 geometry(512));"] for _stb in CREATE_STB_LIST: tdSql.execute(_stb) tdSql.query(f'show {dbname}.stables') tdSql.checkRows(len(CREATE_STB_LIST)) + for _stb in CREATE_NTB_LIST: + tdSql.execute(_stb) + tdSql.query(f'show {dbname}.tables') + tdSql.checkRows(len(CREATE_NTB_LIST)) + def _query_check_varchar(self, result, okv, nv, row = 0, col = 0): for i in range(row): for j in range(1, col): @@ -147,12 +163,18 @@ class TDTestCase: tdSql.checkEqual(check_result, True) - def _query_check(self, dbname="db", stbname="", ctbname="", nRows = 0, okv = None, nv = None, dtype = TDDataType.NULL): + def _query_check(self, dbname="db", stbname="", ctbname="", ntbname="",nRows = 0, okv = None, nv = None, dtype = TDDataType.NULL): result = None - if dtype != TDDataType.GEOMETRY: # geometry query by py connector need to be supported - tdSql.query(f'select * from {dbname}.{stbname}') + if stbname: + if dtype != TDDataType.GEOMETRY: # geometry query by py connector need to be supported + tdSql.query(f'select * from {dbname}.{stbname}') + tdSql.checkRows(nRows) + result = tdSql.queryResult + else: + tdSql.query(f'select * from {dbname}.{ntbname}') tdSql.checkRows(nRows) result = tdSql.queryResult + if dtype == TDDataType.VARCHAR or dtype == TDDataType.NCHAR: self._query_check_varchar(result, okv, nv, nRows, 4) @@ -176,48 +198,101 @@ class TDTestCase: if ctbname != "": tdSql.execute(f'drop table {dbname}.{ctbname}') - def __insert_query_common(self, dbname="db", stbname="", ctbname="", oklist=[], kolist=[], okv=None, dtype = TDDataType.NULL): + def __insert_query_common(self, dbname="db", stbname="", ctbname="", ntbname="", oklist=[], kolist=[], okv=None, dtype = TDDataType.NULL): tdLog.info(f'{dbname}.{stbname} {ctbname}, oklist:%d, kolist:%d'%(len(oklist), len(kolist))) tdSql.checkEqual(34, len(oklist) + len(kolist)) + # while True: + # tdSql.execute(f'insert into db.ntb_ge values(now, "POINT (1.000000 1.000000)", "POINT (1.000000 1.000000)")') + # # tdSql.execute(f'insert into db.ntb_ge values(now + 1s, "POINT (1.000000 1.000000)", "POINT (1.000000 1.000000)")') + # # tdSql.execute(f'insert into db.ntb_ge values(now + 2s, "POINT (1.000000 1.000000)", "POINT (1.000000 1.000000)")') + + # # self._query_check(dbname, None, None, ntbname, 3, okv, _e, dtype) + # # time.sleep(1) + # # print('sleep 1s') + # tdSql.query(f'select * from db.ntb_ge', queryTimes=1) + # tdSql.checkRows(3) + # tdSql.query(f'delete from db.ntb_ge') + for _l in kolist: for _e in _l: + # create sub-table manually, check tag tdSql.error(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags(%s, {okv})' %(_e)) tdSql.error(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, %s)' %(_e)) tdSql.error(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags(%s, %s)' %(_e, _e)) + + # create sub-table automatically, check tag tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, %s) values(now, {okv}, {okv})' %(_e)) tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags(%s, {okv}) values(now, {okv}, {okv})' %(_e)) + + # create sub-table automatically, check value tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, {okv}) values(now, %s, {okv})' %(_e)) tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, {okv}) values(now, {okv}, %s)' %(_e)) tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, {okv}) values(now, %s, %s)' %(_e, _e)) + + # check alter table tag tdSql.execute(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, {okv}) values(now, {okv}, {okv})') - self._query_check(dbname,stbname, "", 1, okv, _e, dtype) + self._query_check(dbname,stbname, "", None, 1, okv, _e, dtype) tdSql.execute(f'alter table {dbname}.{ctbname} set tag t0 = {okv}') tdSql.error(f'alter table {dbname}.{ctbname} set tag t0 = %s' %(_e)) tdSql.error(f'alter table {dbname}.{ctbname} set tag t1 = %s' %(_e)) tdSql.execute(f'drop table {dbname}.{ctbname}') + + # insert into normal table, check value + tdSql.error(f'insert into {dbname}.{ntbname} values(now, %s, {okv})' %(_e)) + tdSql.error(f'insert into {dbname}.{ntbname} values(now, {okv}, %s)' %(_e)) + tdSql.error(f'insert into {dbname}.{ntbname} values(now, %s, %s)' %(_e, _e)) + for _l in oklist: for _e in _l: - tdLog.info(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags(%s, {okv})' %(_e)) - tdSql.execute(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags(%s, {okv})' %(_e)) - tdSql.execute(f'insert into {dbname}.{ctbname} values(now + 0s, %s, {okv})' %(_e)) - tdSql.execute(f'insert into {dbname}.{ctbname} values(now + 1s, {okv}, %s)' %(_e)) - tdSql.execute(f'insert into {dbname}.{ctbname} values(now + 2s, %s, %s)' %(_e, _e)) - tdLog.info(f'insert into {dbname}.{ctbname} values(now + 0s, %s, {okv})' %(_e)) - tdLog.info(f'insert into {dbname}.{ctbname} values(now + 1s, {okv}, %s)' %(_e)) - tdLog.info(f'insert into {dbname}.{ctbname} values(now + 2s, %s, %s)' %(_e, _e)) - tdSql.execute(f'alter table {dbname}.{ctbname} set tag t0 = %s' %(_e)) - tdSql.execute(f'alter table {dbname}.{ctbname} set tag t1 = %s' %(_e)) - self._query_check(dbname,stbname, ctbname, 3, okv, _e, dtype) - tdSql.execute(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags(%s, %s)' %(_e, _e)) - tdSql.execute(f'insert into {dbname}.{ctbname} values(now, %s, %s)' %(_e, _e)) - self._query_check(dbname,stbname, ctbname, 1, okv, _e, dtype) - tdSql.execute(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags(%s, {okv}) values(now, %s, {okv})' %(_e, _e)) - self._query_check(dbname,stbname, ctbname, 1, okv, _e, dtype) - tdSql.execute(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, %s) values(now, {okv}, %s)' %(_e, _e)) - self._query_check(dbname,stbname, ctbname, 1, okv, _e, dtype) - tdSql.execute(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags(%s, %s) values(now, %s, %s)' %(_e, _e, _e, _e)) - self._query_check(dbname,stbname, ctbname, 1, okv, _e, dtype) + # 1. create sub-table manually, check tag + tdSql.execute(f'create table {dbname}.{ctbname}_1 using {dbname}.{stbname} tags(%s, {okv})' %(_e)) + tdSql.execute(f'create table {dbname}.{ctbname}_2 using {dbname}.{stbname} tags({okv}, %s)' %(_e)) + tdSql.execute(f'create table {dbname}.{ctbname}_3 using {dbname}.{stbname} tags(%s, %s)' %(_e, _e)) + + + # 1.1 insert into sub-table, check value + tdSql.execute(f'insert into {dbname}.{ctbname}_1 values(now + 0s, %s, {okv})' %(_e)) + tdSql.execute(f'insert into {dbname}.{ctbname}_2 values(now + 1s, {okv}, %s)' %(_e)) + tdSql.execute(f'insert into {dbname}.{ctbname}_3 values(now + 2s, %s, %s)' %(_e, _e)) + + # 1.2 check alter table tag + tdSql.execute(f'alter table {dbname}.{ctbname}_1 set tag t0 = %s' %(_e)) + tdSql.execute(f'alter table {dbname}.{ctbname}_2 set tag t1 = %s' %(_e)) + + # 1.3 check table data + self._query_check(dbname, stbname, f'{ctbname}_1', None, 3, okv, _e, dtype) + self._query_check(dbname, stbname, f'{ctbname}_2', None, 2, okv, _e, dtype) + self._query_check(dbname, stbname, f'{ctbname}_3', None, 1, okv, _e, dtype) + + # 2. insert into value by creating sub-table automatically, check tag & value + tdSql.execute(f'insert into {dbname}.{ctbname}_1 using {dbname}.{stbname} tags(%s, {okv}) values(now, %s, {okv})' %(_e, _e)) + tdSql.execute(f'insert into {dbname}.{ctbname}_2 using {dbname}.{stbname} tags({okv}, %s) values(now + 1s, {okv}, %s)' %(_e, _e)) + tdSql.execute(f'insert into {dbname}.{ctbname}_3 using {dbname}.{stbname} tags(%s, %s) values(now + 2s, %s, %s)' %(_e, _e, _e, _e)) + + self._query_check(dbname, stbname, f'{ctbname}_1', None, 3, okv, _e, dtype) + self._query_check(dbname, stbname, f'{ctbname}_2', None, 2, okv, _e, dtype) + self._query_check(dbname, stbname, f'{ctbname}_3', None, 1, okv, _e, dtype) + + # 3. insert into value by supper-table, check tag & value + tdSql.execute(f'insert into {dbname}.{stbname}(tbname, t0, t1, ts, c0, c1) values("{ctbname}_1", %s, {okv}, now, %s, {okv})' %(_e, _e)) + tdSql.execute(f'insert into {dbname}.{stbname}(tbname, t0, t1, ts, c0, c1) values("{ctbname}_2", {okv}, %s, now + 1s, {okv}, %s)' %(_e, _e)) + tdSql.execute(f'insert into {dbname}.{stbname}(tbname, t0, t1, ts, c0, c1) values("{ctbname}_3", %s, %s, now + 2s, %s, %s)' %(_e, _e, _e, _e)) + + self._query_check(dbname, stbname, f'{ctbname}_1', None, 3, okv, _e, dtype) + self._query_check(dbname, stbname, f'{ctbname}_2', None, 2, okv, _e, dtype) + self._query_check(dbname, stbname, f'{ctbname}_3', None, 1, okv, _e, dtype) + + # 4. insert value into normal table + tdSql.execute(f'insert into {dbname}.{ntbname} values(now, %s, {okv})' %(_e)) + tdSql.execute(f'insert into {dbname}.{ntbname} values(now + 1s, {okv}, %s)' %(_e)) + tdSql.execute(f'insert into {dbname}.{ntbname} values(now + 2s, %s, %s)' %(_e, _e)) + + if dtype != TDDataType.GEOMETRY: + # self._query_check(dbname, None, None, ntbname, 3, okv, _e, dtype) + tdSql.query(f'select * from {dbname}.{ntbname}') + tdSql.checkRows(3) + tdSql.query(f'delete from {dbname}.{ntbname}') def __insert_query_json(self, dbname="db", stbname="", ctbname="", oklist=[], kolist=[], okv=None): tdLog.info(f'{dbname}.{stbname} {ctbname}, oklist:%d, kolist:%d'%(len(oklist), len(kolist))) @@ -244,7 +319,7 @@ class TDTestCase: def __insert_query_exec(self): STR_EMPTY = ['\'\'', "\"\"", '\' \'', "\" \""] - STR_INTEGER_P = ["\"42\"", '\'+42\'', '\'+0\'', '\'-0\'', '\'0x2A\'', '\'-0X0\'', '\'+0x0\'', '\'0B00101010\'', '\'-0b00\''] + STR_INTEGER_P = ["\"42\"", '\'+42\'', '\'+0\'', '\'1\'','\'-0\'', '\'0x2A\'', '\'-0X0\'', '\'+0x0\'', '\'0B00101010\'', '\'-0b00\''] STR_INTEGER_M = ['\'-128\'', '\'-0X1\'', '\"-0x34\"', '\'-0b01\'', '\'-0B00101010\''] STR_FLOAT_P = ['\'42.1\'', "\"+0.003\"", "\'-0.0\'"] STR_FLOAT_M = ["\"-32.001\""] @@ -320,21 +395,21 @@ class TDTestCase: RAW_FLOAT_P, RAW_FLOAT_M, RAW_FLOAT_E_P, RAW_FLOAT_E_M] PARAM_LIST = [ - ["db", "stb_vc", "ctb_vc", OK_VC, KO_VC, "\'vc\'", TDDataType.VARCHAR], - ["db", "stb_nc", "ctb_nc", OK_NC, KO_NC, "\'nc\'", TDDataType.NCHAR], - ["db", "stb_ts", "ctb_ts", OK_TS, KO_TS, "now", TDDataType.TIMESTAMP], - ["db", "stb_bo", "ctb_bo", OK_BO, KO_BO, "true", TDDataType.BOOL], - ["db", "stb_vb", "ctb_vb", OK_VB, KO_VB, "\'\\x12\'", TDDataType.VARBINARY], - ["db", "stb_in", "ctb_in", OK_IN, KO_IN, "-1", TDDataType.UINT], - ["db", "stb_ui", "ctb_ui", OK_UI, KO_UI, "1", TDDataType.UINT], - ["db", "stb_fl", "ctb_fl", OK_FL, KO_FL, "1.0", TDDataType.FLOAT], - ["db", "stb_db", "ctb_db", OK_DB, KO_DB, "1.0", TDDataType.DOUBLE], - ["db", "stb_ge", "ctb_ge", OK_GE, KO_GE, "\'POINT(1.0 1.0)\'", TDDataType.GEOMETRY] + ["db", "stb_vc", "ctb_vc", "ntb_vc", OK_VC, KO_VC, "\'vc\'", TDDataType.VARCHAR], + ["db", "stb_nc", "ctb_nc", "ntb_nc", OK_NC, KO_NC, "\'nc\'", TDDataType.NCHAR], + ["db", "stb_ts", "ctb_ts", "ntb_ts", OK_TS, KO_TS, "now", TDDataType.TIMESTAMP], + ["db", "stb_bo", "ctb_bo", "ntb_bo", OK_BO, KO_BO, "true", TDDataType.BOOL], + ["db", "stb_vb", "ctb_vb", "ntb_vb", OK_VB, KO_VB, "\'\\x12\'", TDDataType.VARBINARY], + ["db", "stb_in", "ctb_in", "ntb_in", OK_IN, KO_IN, "-1", TDDataType.UINT], + ["db", "stb_ui", "ctb_ui", "ntb_ui", OK_UI, KO_UI, "1", TDDataType.UINT], + ["db", "stb_fl", "ctb_fl", "ntb_fl", OK_FL, KO_FL, "1.0", TDDataType.FLOAT], + ["db", "stb_db", "ctb_db", "ntb_db", OK_DB, KO_DB, "1.0", TDDataType.DOUBLE], + ["db", "stb_ge", "ctb_ge", "ntb_ge", OK_GE, KO_GE, "\'POINT(1.0 1.0)\'", TDDataType.GEOMETRY] ] # check with common function for _pl in PARAM_LIST: - self.__insert_query_common(_pl[0], _pl[1], _pl[2], _pl[3], _pl[4], _pl[5], _pl[6]) + self.__insert_query_common(_pl[0], _pl[1], _pl[2], _pl[3], _pl[4], _pl[5], _pl[6], _pl[7]) # check json self.__insert_query_json("db", "stb_js", "ctb_js", OK_JS, KO_JS, "\'{\"k1\":\"v1\",\"k2\":\"v2\"}\'") From 9bf540a1b2e9d45d79e4c0759e294b824bfc04e5 Mon Sep 17 00:00:00 2001 From: Chris Zhai Date: Wed, 20 Mar 2024 17:35:21 +0800 Subject: [PATCH 2/4] update test case for ts-4421 - v2 --- tests/pytest/util/sql.py | 1 + .../1-insert/insert_column_value.py | 82 ++++++++++++------- 2 files changed, 53 insertions(+), 30 deletions(-) diff --git a/tests/pytest/util/sql.py b/tests/pytest/util/sql.py index 7ccb290d62..783009b3fb 100644 --- a/tests/pytest/util/sql.py +++ b/tests/pytest/util/sql.py @@ -169,6 +169,7 @@ class TDSql: i=1 while i <= queryTimes: try: + tdLog.info(sql) self.cursor.execute(sql) self.queryResult = self.cursor.fetchall() self.queryRows = len(self.queryResult) diff --git a/tests/system-test/1-insert/insert_column_value.py b/tests/system-test/1-insert/insert_column_value.py index 73d9aaeeda..6726a33ea4 100644 --- a/tests/system-test/1-insert/insert_column_value.py +++ b/tests/system-test/1-insert/insert_column_value.py @@ -47,8 +47,9 @@ class TDTestCase: tdSql.execute(f'create database if not exists db vgroups 1') def __create_tb(self, dbname="db"): - CREATE_STB_LIST = [ f"create table {dbname}.stb_vc (ts timestamp, c0 binary(50), c1 varchar(50)) tags(t0 varchar(50), t1 binary(50));", + CREATE_STB_LIST = [ f"create table {dbname}.stb_vc (ts timestamp, c0 varchar(50), c1 varchar(50)) tags(t0 varchar(50), t1 varchar(50));", f"create table {dbname}.stb_nc (ts timestamp, c0 nchar(50), c1 nchar(50)) tags(t0 nchar(50), t1 nchar(50));", + f"create table {dbname}.stb_bi (ts timestamp, c0 binary(50), c1 binary(50)) tags(t0 binary(50), t1 binary(50));", f"create table {dbname}.stb_ts (ts timestamp, c0 timestamp, c1 timestamp) tags(t0 timestamp, t1 timestamp);", f"create table {dbname}.stb_bo (ts timestamp, c0 bool, c1 bool) tags(t0 bool, t1 bool);", f"create table {dbname}.stb_vb (ts timestamp, c0 varbinary(50), c1 varbinary(50)) tags(t0 varbinary(50), t1 varbinary(50));", @@ -61,6 +62,7 @@ class TDTestCase: CREATE_NTB_LIST = [ f"create table {dbname}.ntb_vc (ts timestamp, c0 binary(50), c1 varchar(50));", f"create table {dbname}.ntb_nc (ts timestamp, c0 nchar(50), c1 nchar(50));", + f"create table {dbname}.ntb_bi (ts timestamp, c0 binary(50), c1 binary(50));", f"create table {dbname}.ntb_ts (ts timestamp, c0 timestamp, c1 timestamp);", f"create table {dbname}.ntb_bo (ts timestamp, c0 bool, c1 bool);", f"create table {dbname}.ntb_vb (ts timestamp, c0 varbinary(50), c1 varbinary(50));", @@ -200,37 +202,29 @@ class TDTestCase: def __insert_query_common(self, dbname="db", stbname="", ctbname="", ntbname="", oklist=[], kolist=[], okv=None, dtype = TDDataType.NULL): tdLog.info(f'{dbname}.{stbname} {ctbname}, oklist:%d, kolist:%d'%(len(oklist), len(kolist))) - tdSql.checkEqual(34, len(oklist) + len(kolist)) - - # while True: - # tdSql.execute(f'insert into db.ntb_ge values(now, "POINT (1.000000 1.000000)", "POINT (1.000000 1.000000)")') - # # tdSql.execute(f'insert into db.ntb_ge values(now + 1s, "POINT (1.000000 1.000000)", "POINT (1.000000 1.000000)")') - # # tdSql.execute(f'insert into db.ntb_ge values(now + 2s, "POINT (1.000000 1.000000)", "POINT (1.000000 1.000000)")') - - # # self._query_check(dbname, None, None, ntbname, 3, okv, _e, dtype) - # # time.sleep(1) - # # print('sleep 1s') - # tdSql.query(f'select * from db.ntb_ge', queryTimes=1) - # tdSql.checkRows(3) - # tdSql.query(f'delete from db.ntb_ge') + # tdSql.checkEqual(34, len(oklist) + len(kolist)) for _l in kolist: for _e in _l: # create sub-table manually, check tag + tdLog.info('ko:create sub-table manually, check tag') tdSql.error(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags(%s, {okv})' %(_e)) tdSql.error(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, %s)' %(_e)) tdSql.error(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags(%s, %s)' %(_e, _e)) # create sub-table automatically, check tag + tdLog.info('ko:create sub-table automatically, check tag') tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, %s) values(now, {okv}, {okv})' %(_e)) tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags(%s, {okv}) values(now, {okv}, {okv})' %(_e)) # create sub-table automatically, check value + tdLog.info('ko:create sub-table automatically, check value') tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, {okv}) values(now, %s, {okv})' %(_e)) tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, {okv}) values(now, {okv}, %s)' %(_e)) tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, {okv}) values(now, %s, %s)' %(_e, _e)) # check alter table tag + tdLog.info('ko:check alter table tag') tdSql.execute(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, {okv}) values(now, {okv}, {okv})') self._query_check(dbname,stbname, "", None, 1, okv, _e, dtype) tdSql.execute(f'alter table {dbname}.{ctbname} set tag t0 = {okv}') @@ -239,6 +233,7 @@ class TDTestCase: tdSql.execute(f'drop table {dbname}.{ctbname}') # insert into normal table, check value + tdLog.info('ko:insert into normal table, check value') tdSql.error(f'insert into {dbname}.{ntbname} values(now, %s, {okv})' %(_e)) tdSql.error(f'insert into {dbname}.{ntbname} values(now, {okv}, %s)' %(_e)) tdSql.error(f'insert into {dbname}.{ntbname} values(now, %s, %s)' %(_e, _e)) @@ -246,26 +241,31 @@ class TDTestCase: for _l in oklist: for _e in _l: # 1. create sub-table manually, check tag + tdLog.info('ok:create sub-table manually, check tag') tdSql.execute(f'create table {dbname}.{ctbname}_1 using {dbname}.{stbname} tags(%s, {okv})' %(_e)) tdSql.execute(f'create table {dbname}.{ctbname}_2 using {dbname}.{stbname} tags({okv}, %s)' %(_e)) tdSql.execute(f'create table {dbname}.{ctbname}_3 using {dbname}.{stbname} tags(%s, %s)' %(_e, _e)) # 1.1 insert into sub-table, check value + tdLog.info('ok:insert into sub-table, check value') tdSql.execute(f'insert into {dbname}.{ctbname}_1 values(now + 0s, %s, {okv})' %(_e)) tdSql.execute(f'insert into {dbname}.{ctbname}_2 values(now + 1s, {okv}, %s)' %(_e)) tdSql.execute(f'insert into {dbname}.{ctbname}_3 values(now + 2s, %s, %s)' %(_e, _e)) # 1.2 check alter table tag - tdSql.execute(f'alter table {dbname}.{ctbname}_1 set tag t0 = %s' %(_e)) - tdSql.execute(f'alter table {dbname}.{ctbname}_2 set tag t1 = %s' %(_e)) + tdLog.info('ok:check alter table tag') + tdSql.execute(f'alter table {dbname}.{ctbname}_1 set tag t1 = %s' %(_e)) + tdSql.execute(f'alter table {dbname}.{ctbname}_2 set tag t0 = %s' %(_e)) # 1.3 check table data + tdLog.info('ok:check table data') self._query_check(dbname, stbname, f'{ctbname}_1', None, 3, okv, _e, dtype) self._query_check(dbname, stbname, f'{ctbname}_2', None, 2, okv, _e, dtype) self._query_check(dbname, stbname, f'{ctbname}_3', None, 1, okv, _e, dtype) # 2. insert into value by creating sub-table automatically, check tag & value + tdLog.info('ok:insert into value by creating sub-table automatically, check tag & value') tdSql.execute(f'insert into {dbname}.{ctbname}_1 using {dbname}.{stbname} tags(%s, {okv}) values(now, %s, {okv})' %(_e, _e)) tdSql.execute(f'insert into {dbname}.{ctbname}_2 using {dbname}.{stbname} tags({okv}, %s) values(now + 1s, {okv}, %s)' %(_e, _e)) tdSql.execute(f'insert into {dbname}.{ctbname}_3 using {dbname}.{stbname} tags(%s, %s) values(now + 2s, %s, %s)' %(_e, _e, _e, _e)) @@ -275,6 +275,7 @@ class TDTestCase: self._query_check(dbname, stbname, f'{ctbname}_3', None, 1, okv, _e, dtype) # 3. insert into value by supper-table, check tag & value + tdLog.info('ok:insert into value by supper-table, check tag & value') tdSql.execute(f'insert into {dbname}.{stbname}(tbname, t0, t1, ts, c0, c1) values("{ctbname}_1", %s, {okv}, now, %s, {okv})' %(_e, _e)) tdSql.execute(f'insert into {dbname}.{stbname}(tbname, t0, t1, ts, c0, c1) values("{ctbname}_2", {okv}, %s, now + 1s, {okv}, %s)' %(_e, _e)) tdSql.execute(f'insert into {dbname}.{stbname}(tbname, t0, t1, ts, c0, c1) values("{ctbname}_3", %s, %s, now + 2s, %s, %s)' %(_e, _e, _e, _e)) @@ -284,6 +285,7 @@ class TDTestCase: self._query_check(dbname, stbname, f'{ctbname}_3', None, 1, okv, _e, dtype) # 4. insert value into normal table + tdLog.info('ok:insert value into normal table') tdSql.execute(f'insert into {dbname}.{ntbname} values(now, %s, {okv})' %(_e)) tdSql.execute(f'insert into {dbname}.{ntbname} values(now + 1s, {okv}, %s)' %(_e)) tdSql.execute(f'insert into {dbname}.{ntbname} values(now + 2s, %s, %s)' %(_e, _e)) @@ -296,7 +298,7 @@ class TDTestCase: def __insert_query_json(self, dbname="db", stbname="", ctbname="", oklist=[], kolist=[], okv=None): tdLog.info(f'{dbname}.{stbname} {ctbname}, oklist:%d, kolist:%d'%(len(oklist), len(kolist))) - tdSql.checkEqual(34, len(oklist) + len(kolist)) + # tdSql.checkEqual(34, len(oklist) + len(kolist)) for _l in kolist: for _e in _l: @@ -319,6 +321,8 @@ class TDTestCase: def __insert_query_exec(self): STR_EMPTY = ['\'\'', "\"\"", '\' \'', "\" \""] + STR_CHINESE = ['\'年年岁岁,花相似\''] + STR_CHINESE_ILLEGAL = ['\'洛阳城东桃李花,飞来飞去落谁家。幽闺女儿爱颜色,坐见落花长叹息。今岁花开君不待。明年花开复谁在。故人不共洛阳东,今来空对落花风。年年岁岁花相似,岁岁年年人不同\''] STR_INTEGER_P = ["\"42\"", '\'+42\'', '\'+0\'', '\'1\'','\'-0\'', '\'0x2A\'', '\'-0X0\'', '\'+0x0\'', '\'0B00101010\'', '\'-0b00\''] STR_INTEGER_M = ['\'-128\'', '\'-0X1\'', '\"-0x34\"', '\'-0b01\'', '\'-0B00101010\''] STR_FLOAT_P = ['\'42.1\'', "\"+0.003\"", "\'-0.0\'"] @@ -334,11 +338,16 @@ class TDTestCase: STR_TSKP_MISC = ['\'now()+1s\'', '\' now()\'', '\'now( )\'', '\'today() \'', '\'today())\'', '\'today()+1m\'', '\'today()-1w\''] STR_BOOL = ['\'true\'', '\'false\'', '\'TRUE\'', '\'FALSE\'', '\'tRuE\'', '\'falsE\''] STR_TS = ["\"2024-02-01 00:00:01.001-08:00\"", "\'2024-02-01T00:00:01.001+09:00\'", "\"2024-02-01\"", "\'2024-02-02 00:00:01\'", "\'2024-02-02 00:00:01.009\'"] + STR_TS_ILLEGAL = ["\"2023-2024-02-01 00:00:01.001-08:00\"", "\'2024-02-01T99:00:01.001+09:00\'", "\"2024-02-31\"", "\'2024-02-02 00:88:01\'", "\'2024-02-02 00:00:77.009\'"] STR_VARBIN = ['\'\\x12\'', '\'\\x13\'', '\' \\x14 \'', '\'\\x12ab\''] STR_JSON_O = ['\'{\"k1\":\"v1\"}\'', '\' {} \''] - STR_JSON_A = ['\'[]\''] + STR_JSON_A = ['\'[]\'', '\"{\'k1\': \'v1\',\'k2\'}\"', '\"{\'k1\': \'v1\'}}\"'] STR_GEO = ['\' POINT(1.0 1.0)\'', '\'LINESTRING(1.00 +2.0, 2.1 -3.2, 5.00 5.01) \'', '\'POLYGON((1.0 1.0, -2.0 +2.0, 1.0 1.0))\'' ] + STR_GEO_ILLEGAL = ['\' POINT(1.0)\'', '\'LINESTRING(1.00 +2.0, -3.2, 5.00 5.01) \'', '\'POLYGON((-2.0 +2.0, 1.0 1.0))\'' ] STR_NULL = ['\'NuLl\'', '\'null\'', '\'NULL\''] + STR_NONE = ['\'NoNe\'', '\'none\'', '\'NONE\''] + STR_BINARY = ['\'\\x7f8290\'', '\'\\X7f8290\'', '\'x7f8290\'', '\'\\x\''] # bug TD-29193 + STR_BINARY_ILLEGAL = ['\'\\x7f829\''] RAW_INTEGER_P = [' 42 ', '+042 ', ' +0', '0 ', '-0', '0', ' 0X2A', ' -0x0 ', '+0x0 ', ' 0B00101010', ' -0b00'] RAW_INTEGER_M = [' -42 ', ' -0128',' -0x1', ' -0X2A', '-0b01 ', ' -0B00101010 '] @@ -346,6 +355,7 @@ class TDTestCase: RAW_FLOAT_M = ['-128.001 '] RAW_FLOAT_E_P = [' 1e-100', ' +0.1E+2', ' -0.1E-10'] RAW_FLOAT_E_M = [" -1E2 "] + RAW_FLOAT_E_M_SPE = ["-1e-100"] RAW_MISC = ['123abc', "123c", '-123d', '+', '-', ' *', ' /', '% ', '&', "|", "^", "&&", "||", "!", " =", ' None ', 'NONE', 'now+1 s', 'now-1','now-1y','now+2 d', 'today+1 s', 'today-1','today-1y','today+2 d', 'now()+1 s', 'now()-1','now()-1y','now()+2 d', 'today()+1 s', 'today()-1','today()-1y','today()+2 d'] RAW_OPTR = ['1*10', '1+2', '-2-0','1%2', '2/0', '1&31'] @@ -355,48 +365,60 @@ class TDTestCase: RAW_TSKP_OPTR = [' noW ( ) + 1s', 'nOw( ) + 2D', 'NOW () + 000s', ' today()+1M', 'today( ) - 1w ', 'TodaY ( ) - 1U '] RAW_BOOL = ['true', 'false', ' TRUE ', 'FALSE ', ' tRuE', ' falsE '] RAW_NULL = ['NuLl', 'null ', ' NULL', ' NULL '] + RAW_NONE = ['None', 'none ', ' NoNe', ' NONE '] + RAW_BINARY_ILLEGAL = ['\\x7f8290', '\\X7f8290', 'x7f8290', '\\x', '\\x7f829'] OK_VC = [STR_EMPTY, STR_INTEGER_P, STR_INTEGER_M, STR_FLOAT_P, STR_FLOAT_M, STR_FLOAT_E_P, STR_FLOAT_E_M, STR_MISC, STR_OPTR, STR_TSK, STR_TSK_MISC, STR_TSKP, STR_TSKP_MISC, STR_BOOL, STR_TS, STR_VARBIN, STR_JSON_O, STR_JSON_A, STR_GEO, STR_NULL, RAW_INTEGER_P, RAW_INTEGER_M, RAW_FLOAT_P, RAW_FLOAT_M, - RAW_FLOAT_E_P, RAW_FLOAT_E_M, RAW_TSK, RAW_BOOL, RAW_NULL] - KO_VC = [RAW_MISC, RAW_OPTR, RAW_TSK_OPTR, RAW_TSKP, RAW_TSKP_OPTR] + RAW_FLOAT_E_P, RAW_FLOAT_E_M, RAW_TSK, RAW_BOOL, RAW_NULL, STR_CHINESE, STR_NONE] + KO_VC = [RAW_MISC, RAW_OPTR, RAW_TSK_OPTR, RAW_TSKP, RAW_TSKP_OPTR, STR_CHINESE_ILLEGAL, RAW_NONE] OK_NC = OK_VC KO_NC = KO_VC + OK_BI = OK_VC + KO_BI = KO_VC OK_TS = [STR_TSK, STR_INTEGER_P, STR_INTEGER_M, STR_TSKP, STR_TS, STR_NULL, RAW_INTEGER_P, RAW_INTEGER_M, RAW_TSK, RAW_TSK_OPTR, RAW_TSKP, RAW_TSKP_OPTR, RAW_NULL] KO_TS = [STR_EMPTY, STR_FLOAT_P, STR_FLOAT_M, STR_FLOAT_E_P, STR_FLOAT_E_M, STR_MISC, STR_OPTR, STR_TSK_MISC, STR_TSKP_MISC, STR_BOOL, STR_VARBIN, - STR_JSON_O, STR_JSON_A, STR_GEO, RAW_FLOAT_P, RAW_FLOAT_M, RAW_FLOAT_E_P, RAW_FLOAT_E_M, RAW_MISC, RAW_OPTR, RAW_BOOL] + STR_JSON_O, STR_JSON_A, STR_GEO, RAW_FLOAT_P, RAW_FLOAT_M, RAW_FLOAT_E_P, RAW_FLOAT_E_M, RAW_MISC, RAW_OPTR, RAW_BOOL, STR_CHINESE, STR_NONE, STR_TS_ILLEGAL, + STR_BINARY, RAW_NONE] OK_BO = [STR_BOOL, STR_INTEGER_P, STR_INTEGER_M, STR_FLOAT_P, STR_FLOAT_M, STR_FLOAT_E_P, STR_FLOAT_E_M,RAW_BOOL, STR_NULL, RAW_INTEGER_P, RAW_INTEGER_M, RAW_FLOAT_P, RAW_FLOAT_M, RAW_FLOAT_E_P, RAW_FLOAT_E_M, RAW_NULL] KO_BO = [STR_EMPTY, STR_TSK, STR_TSKP, STR_TS, STR_MISC, STR_OPTR, STR_TSK_MISC, STR_TSKP_MISC, STR_VARBIN, STR_JSON_O, STR_JSON_A, STR_GEO, RAW_TSK, - RAW_TSK_OPTR, RAW_TSKP, RAW_TSKP_OPTR, RAW_MISC, RAW_OPTR] + RAW_TSK_OPTR, RAW_TSKP, RAW_TSKP_OPTR, RAW_MISC, RAW_OPTR, STR_CHINESE, STR_NONE, STR_BINARY, RAW_NONE] OK_VB = [STR_EMPTY, STR_INTEGER_P, STR_INTEGER_M, STR_FLOAT_P, STR_FLOAT_M, STR_FLOAT_E_P, STR_FLOAT_E_M, STR_MISC, STR_OPTR, STR_TSK, STR_TSK_MISC, STR_TSKP, - STR_TSKP_MISC, STR_BOOL, STR_TS, STR_VARBIN, STR_JSON_O, STR_JSON_A, STR_GEO, STR_NULL, RAW_NULL] - KO_VB = [RAW_INTEGER_P, RAW_INTEGER_M, RAW_FLOAT_P, RAW_FLOAT_M, RAW_FLOAT_E_P, RAW_FLOAT_E_M, RAW_TSK, RAW_BOOL, RAW_MISC, RAW_OPTR, RAW_TSK_OPTR, RAW_TSKP, RAW_TSKP_OPTR] + STR_TSKP_MISC, STR_BOOL, STR_TS, STR_VARBIN, STR_JSON_O, STR_JSON_A, STR_GEO, STR_NULL, RAW_NULL, STR_CHINESE, STR_NONE, STR_BINARY] + KO_VB = [RAW_INTEGER_P, RAW_INTEGER_M, RAW_FLOAT_P, RAW_FLOAT_M, RAW_FLOAT_E_P, RAW_FLOAT_E_M, RAW_TSK, RAW_BOOL, RAW_MISC, RAW_OPTR, RAW_TSK_OPTR, RAW_TSKP, RAW_TSKP_OPTR, + STR_BINARY_ILLEGAL, STR_BINARY_ILLEGAL, RAW_BINARY_ILLEGAL, RAW_NONE] OK_IN = [STR_INTEGER_P, STR_INTEGER_M, STR_FLOAT_P, STR_FLOAT_M, STR_FLOAT_E_P, STR_FLOAT_E_M, STR_NULL, RAW_INTEGER_P, RAW_INTEGER_M, RAW_FLOAT_P, RAW_FLOAT_M, RAW_FLOAT_E_P, RAW_FLOAT_E_M, RAW_NULL] KO_IN = [STR_EMPTY, STR_MISC, STR_OPTR, STR_TSK, STR_TSK_MISC, STR_TSKP, STR_TSKP_MISC, STR_BOOL, STR_TS, STR_VARBIN, STR_JSON_O, STR_JSON_A, STR_GEO, RAW_TSK, - RAW_BOOL, RAW_MISC, RAW_OPTR, RAW_TSK_OPTR, RAW_TSKP, RAW_TSKP_OPTR] - OK_UI = [STR_INTEGER_P, STR_FLOAT_P, STR_FLOAT_E_P, STR_NULL, RAW_INTEGER_P, RAW_FLOAT_P, RAW_FLOAT_E_P, RAW_NULL] + RAW_BOOL, RAW_MISC, RAW_OPTR, RAW_TSK_OPTR, RAW_TSKP, RAW_TSKP_OPTR, STR_CHINESE, STR_NONE, STR_BINARY, RAW_NONE] + OK_UI = [STR_INTEGER_P, STR_FLOAT_P, STR_FLOAT_E_P, STR_NULL, RAW_INTEGER_P, RAW_FLOAT_P, RAW_FLOAT_E_P, RAW_NULL, RAW_FLOAT_E_M_SPE] KO_UI = [STR_EMPTY, STR_MISC, STR_INTEGER_M, STR_FLOAT_M, STR_FLOAT_E_M, STR_OPTR, STR_TSK, STR_TSK_MISC, STR_TSKP, STR_TSKP_MISC, STR_BOOL, STR_TS, STR_VARBIN, - STR_JSON_O, STR_JSON_A, STR_GEO, RAW_TSK, RAW_BOOL, RAW_INTEGER_M, RAW_FLOAT_M, RAW_FLOAT_E_M, RAW_MISC, RAW_OPTR, RAW_TSK_OPTR, RAW_TSKP, RAW_TSKP_OPTR] + STR_JSON_O, STR_JSON_A, STR_GEO, RAW_TSK, RAW_BOOL, RAW_INTEGER_M, RAW_FLOAT_M, RAW_FLOAT_E_M, RAW_MISC, RAW_OPTR, RAW_TSK_OPTR, RAW_TSKP, RAW_TSKP_OPTR, + STR_CHINESE, STR_NONE, RAW_NONE] OK_FL = [RAW_INTEGER_P, STR_INTEGER_P, STR_INTEGER_M, STR_FLOAT_P, STR_FLOAT_M, STR_FLOAT_E_P, STR_FLOAT_E_M, STR_NULL, RAW_INTEGER_M, RAW_FLOAT_P, RAW_FLOAT_M, RAW_FLOAT_E_P, RAW_FLOAT_E_M, RAW_NULL] KO_FL = [STR_EMPTY, STR_MISC, STR_OPTR, STR_TSK, STR_TSK_MISC, STR_TSKP, STR_TSKP_MISC, STR_BOOL, STR_TS, STR_VARBIN, STR_JSON_O, STR_JSON_A, STR_GEO, RAW_TSK, - RAW_BOOL, RAW_MISC, RAW_OPTR, RAW_TSK_OPTR, RAW_TSKP, RAW_TSKP_OPTR] + RAW_BOOL, RAW_MISC, RAW_OPTR, RAW_TSK_OPTR, RAW_TSKP, RAW_TSKP_OPTR, STR_CHINESE, STR_NONE, STR_BINARY, RAW_NONE] OK_DB = OK_FL KO_DB = KO_FL OK_GE = [STR_GEO, STR_NULL, RAW_NULL] KO_GE = [STR_EMPTY, STR_MISC, STR_OPTR, STR_TSK, STR_TSK_MISC, STR_TSKP, STR_TSKP_MISC, STR_BOOL, STR_TS, STR_JSON_O, STR_JSON_A, STR_VARBIN, RAW_TSK, RAW_BOOL, RAW_MISC, RAW_OPTR, RAW_TSK_OPTR, RAW_TSKP, RAW_TSKP_OPTR, STR_INTEGER_P, STR_INTEGER_M, STR_FLOAT_P, STR_FLOAT_M, STR_FLOAT_E_P, STR_FLOAT_E_M, RAW_INTEGER_P, RAW_INTEGER_M, - RAW_FLOAT_P, RAW_FLOAT_M, RAW_FLOAT_E_P, RAW_FLOAT_E_M] + RAW_FLOAT_P, RAW_FLOAT_M, RAW_FLOAT_E_P, RAW_FLOAT_E_M, STR_CHINESE, STR_NONE, STR_BINARY, STR_GEO_ILLEGAL, RAW_NONE] OK_JS = [STR_EMPTY, STR_JSON_O, STR_NULL, RAW_NULL] KO_JS = [STR_JSON_A, STR_MISC, STR_OPTR, STR_TSK, STR_TSK_MISC, STR_TSKP, STR_TSKP_MISC, STR_BOOL, STR_TS, STR_GEO, STR_VARBIN, RAW_TSK, RAW_BOOL, RAW_MISC, RAW_OPTR, RAW_TSK_OPTR, RAW_TSKP, RAW_TSKP_OPTR, STR_INTEGER_P, STR_INTEGER_M, STR_FLOAT_P, STR_FLOAT_M, STR_FLOAT_E_P, STR_FLOAT_E_M, RAW_INTEGER_P, RAW_INTEGER_M, - RAW_FLOAT_P, RAW_FLOAT_M, RAW_FLOAT_E_P, RAW_FLOAT_E_M] + RAW_FLOAT_P, RAW_FLOAT_M, RAW_FLOAT_E_P, RAW_FLOAT_E_M, STR_CHINESE, STR_NONE, STR_BINARY, RAW_NONE] + + # PARAM_LIST = [ + # ["db", "stb_vc", "ctb_vc", "ntb_vc", OK_VC, KO_VC, "\'vc\'", TDDataType.VARCHAR] + # ] PARAM_LIST = [ ["db", "stb_vc", "ctb_vc", "ntb_vc", OK_VC, KO_VC, "\'vc\'", TDDataType.VARCHAR], ["db", "stb_nc", "ctb_nc", "ntb_nc", OK_NC, KO_NC, "\'nc\'", TDDataType.NCHAR], + ["db", "stb_bi", "ctb_bi", "ntb_bi", OK_BI, KO_BI, "\'bi\'", TDDataType.BINARY], ["db", "stb_ts", "ctb_ts", "ntb_ts", OK_TS, KO_TS, "now", TDDataType.TIMESTAMP], ["db", "stb_bo", "ctb_bo", "ntb_bo", OK_BO, KO_BO, "true", TDDataType.BOOL], ["db", "stb_vb", "ctb_vb", "ntb_vb", OK_VB, KO_VB, "\'\\x12\'", TDDataType.VARBINARY], From facca231f869f9d850405f55c9ee25c162ea6d40 Mon Sep 17 00:00:00 2001 From: Chris Zhai Date: Thu, 21 Mar 2024 14:39:22 +0800 Subject: [PATCH 3/4] update test cases for ts-4421 - v3 --- .../1-insert/insert_column_value.py | 103 +++++++++++++----- 1 file changed, 74 insertions(+), 29 deletions(-) diff --git a/tests/system-test/1-insert/insert_column_value.py b/tests/system-test/1-insert/insert_column_value.py index 6726a33ea4..696401fd6a 100644 --- a/tests/system-test/1-insert/insert_column_value.py +++ b/tests/system-test/1-insert/insert_column_value.py @@ -45,6 +45,8 @@ class TDTestCase: tdSql.init(conn.cursor()) tdSql.execute(f'drop database if exists db') tdSql.execute(f'create database if not exists db vgroups 1') + tdLog.printNoPrefix("create table") + self.__create_tb() def __create_tb(self, dbname="db"): CREATE_STB_LIST = [ f"create table {dbname}.stb_vc (ts timestamp, c0 varchar(50), c1 varchar(50)) tags(t0 varchar(50), t1 varchar(50));", @@ -53,8 +55,14 @@ class TDTestCase: f"create table {dbname}.stb_ts (ts timestamp, c0 timestamp, c1 timestamp) tags(t0 timestamp, t1 timestamp);", f"create table {dbname}.stb_bo (ts timestamp, c0 bool, c1 bool) tags(t0 bool, t1 bool);", f"create table {dbname}.stb_vb (ts timestamp, c0 varbinary(50), c1 varbinary(50)) tags(t0 varbinary(50), t1 varbinary(50));", - f"create table {dbname}.stb_in (ts timestamp, c0 int, c1 smallint) tags(t0 bigint, t1 tinyint);", - f"create table {dbname}.stb_ui (ts timestamp, c0 int unsigned, c1 smallint unsigned) tags(t0 bigint unsigned, t1 tinyint unsigned);", + f"create table {dbname}.stb_in (ts timestamp, c0 int, c1 int) tags(t0 int, t1 int);", + f"create table {dbname}.stb_ui (ts timestamp, c0 int unsigned, c1 int unsigned) tags(t0 int unsigned, t1 int unsigned);", + f"create table {dbname}.stb_bin (ts timestamp, c0 bigint, c1 bigint) tags(t0 bigint, t1 bigint);", + f"create table {dbname}.stb_bui (ts timestamp, c0 bigint unsigned, c1 bigint unsigned) tags(t0 bigint unsigned, t1 bigint unsigned);", + f"create table {dbname}.stb_sin (ts timestamp, c0 smallint, c1 smallint) tags(t0 smallint, t1 smallint);", + f"create table {dbname}.stb_sui (ts timestamp, c0 smallint unsigned, c1 smallint unsigned) tags(t0 smallint unsigned, t1 smallint unsigned);", + f"create table {dbname}.stb_tin (ts timestamp, c0 tinyint, c1 tinyint) tags(t0 tinyint, t1 tinyint);", + f"create table {dbname}.stb_tui (ts timestamp, c0 tinyint unsigned, c1 tinyint unsigned) tags(t0 tinyint unsigned, t1 tinyint unsigned);", f"create table {dbname}.stb_fl (ts timestamp, c0 float, c1 float) tags(t0 float, t1 float);", f"create table {dbname}.stb_db (ts timestamp, c0 double, c1 double) tags(t0 double, t1 double);", f"create table {dbname}.stb_ge (ts timestamp, c0 geometry(512), c1 geometry(512)) tags(t0 geometry(512), t1 geometry(512));", @@ -66,8 +74,14 @@ class TDTestCase: f"create table {dbname}.ntb_ts (ts timestamp, c0 timestamp, c1 timestamp);", f"create table {dbname}.ntb_bo (ts timestamp, c0 bool, c1 bool);", f"create table {dbname}.ntb_vb (ts timestamp, c0 varbinary(50), c1 varbinary(50));", - f"create table {dbname}.ntb_in (ts timestamp, c0 int, c1 smallint);", - f"create table {dbname}.ntb_ui (ts timestamp, c0 int unsigned, c1 smallint unsigned);", + f"create table {dbname}.ntb_in (ts timestamp, c0 int, c1 int);", + f"create table {dbname}.ntb_ui (ts timestamp, c0 int unsigned, c1 int unsigned);", + f"create table {dbname}.ntb_bin (ts timestamp, c0 bigint, c1 bigint);", + f"create table {dbname}.ntb_bui (ts timestamp, c0 bigint unsigned, c1 bigint unsigned);", + f"create table {dbname}.ntb_sin (ts timestamp, c0 smallint, c1 smallint);", + f"create table {dbname}.ntb_sui (ts timestamp, c0 smallint unsigned, c1 smallint unsigned);", + f"create table {dbname}.ntb_tin (ts timestamp, c0 tinyint, c1 tinyint);", + f"create table {dbname}.ntb_tui (ts timestamp, c0 tinyint unsigned, c1 tinyint unsigned);", f"create table {dbname}.ntb_fl (ts timestamp, c0 float, c1 float);", f"create table {dbname}.ntb_db (ts timestamp, c0 double, c1 double);", f"create table {dbname}.ntb_ge (ts timestamp, c0 geometry(512), c1 geometry(512));"] @@ -201,30 +215,30 @@ class TDTestCase: tdSql.execute(f'drop table {dbname}.{ctbname}') def __insert_query_common(self, dbname="db", stbname="", ctbname="", ntbname="", oklist=[], kolist=[], okv=None, dtype = TDDataType.NULL): - tdLog.info(f'{dbname}.{stbname} {ctbname}, oklist:%d, kolist:%d'%(len(oklist), len(kolist))) + tdLog.info(f'[Begin]{dbname}.{stbname} {ctbname}, oklist:%d, kolist:%d, TDDataType:%s'%(len(oklist), len(kolist), dtype)) # tdSql.checkEqual(34, len(oklist) + len(kolist)) for _l in kolist: for _e in _l: # create sub-table manually, check tag - tdLog.info('ko:create sub-table manually, check tag') + tdLog.info('[ko:create sub-table manually, check tag]') tdSql.error(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags(%s, {okv})' %(_e)) tdSql.error(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, %s)' %(_e)) - tdSql.error(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags(%s, %s)' %(_e, _e)) + # tdSql.error(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags(%s, %s)' %(_e, _e)) # create sub-table automatically, check tag - tdLog.info('ko:create sub-table automatically, check tag') + tdLog.info('[ko:create sub-table automatically, check tag]') tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, %s) values(now, {okv}, {okv})' %(_e)) tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags(%s, {okv}) values(now, {okv}, {okv})' %(_e)) # create sub-table automatically, check value - tdLog.info('ko:create sub-table automatically, check value') + tdLog.info('[ko:create sub-table automatically, check value]') tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, {okv}) values(now, %s, {okv})' %(_e)) tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, {okv}) values(now, {okv}, %s)' %(_e)) - tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, {okv}) values(now, %s, %s)' %(_e, _e)) + # tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, {okv}) values(now, %s, %s)' %(_e, _e)) # check alter table tag - tdLog.info('ko:check alter table tag') + tdLog.info('[ko:check alter table tag]') tdSql.execute(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, {okv}) values(now, {okv}, {okv})') self._query_check(dbname,stbname, "", None, 1, okv, _e, dtype) tdSql.execute(f'alter table {dbname}.{ctbname} set tag t0 = {okv}') @@ -232,40 +246,46 @@ class TDTestCase: tdSql.error(f'alter table {dbname}.{ctbname} set tag t1 = %s' %(_e)) tdSql.execute(f'drop table {dbname}.{ctbname}') + # insert into value by supper-table, check tag & value + tdLog.info('[ko:insert into value by supper-table, check tag & value]') + tdSql.error(f'insert into {dbname}.{stbname}(tbname, t0, t1, ts, c0, c1) values("{ctbname}_1", %s, {okv}, now, {okv}, {okv})' %(_e)) + tdSql.error(f'insert into {dbname}.{stbname}(tbname, t0, t1, ts, c0, c1) values("{ctbname}_2", {okv},{okv}, now + 1s, {okv}, %s)' %(_e)) + # tdSql.error(f'insert into {dbname}.{stbname}(tbname, t0, t1, ts, c0, c1) values("{ctbname}_3", %s, %s, now + 2s, %s, %s)' %(_e, _e, _e, _e)) + # insert into normal table, check value - tdLog.info('ko:insert into normal table, check value') + tdLog.info('[ko:insert into normal table, check value]') tdSql.error(f'insert into {dbname}.{ntbname} values(now, %s, {okv})' %(_e)) tdSql.error(f'insert into {dbname}.{ntbname} values(now, {okv}, %s)' %(_e)) - tdSql.error(f'insert into {dbname}.{ntbname} values(now, %s, %s)' %(_e, _e)) + # tdSql.error(f'insert into {dbname}.{ntbname} values(now, %s, %s)' %(_e, _e)) for _l in oklist: for _e in _l: # 1. create sub-table manually, check tag - tdLog.info('ok:create sub-table manually, check tag') + tdLog.info('[ok:create sub-table manually, check tag]') tdSql.execute(f'create table {dbname}.{ctbname}_1 using {dbname}.{stbname} tags(%s, {okv})' %(_e)) tdSql.execute(f'create table {dbname}.{ctbname}_2 using {dbname}.{stbname} tags({okv}, %s)' %(_e)) tdSql.execute(f'create table {dbname}.{ctbname}_3 using {dbname}.{stbname} tags(%s, %s)' %(_e, _e)) # 1.1 insert into sub-table, check value - tdLog.info('ok:insert into sub-table, check value') + tdLog.info('[ok:insert into sub-table, check value]') tdSql.execute(f'insert into {dbname}.{ctbname}_1 values(now + 0s, %s, {okv})' %(_e)) tdSql.execute(f'insert into {dbname}.{ctbname}_2 values(now + 1s, {okv}, %s)' %(_e)) tdSql.execute(f'insert into {dbname}.{ctbname}_3 values(now + 2s, %s, %s)' %(_e, _e)) # 1.2 check alter table tag - tdLog.info('ok:check alter table tag') + tdLog.info('[ok:check alter table tag]') tdSql.execute(f'alter table {dbname}.{ctbname}_1 set tag t1 = %s' %(_e)) tdSql.execute(f'alter table {dbname}.{ctbname}_2 set tag t0 = %s' %(_e)) # 1.3 check table data - tdLog.info('ok:check table data') + tdLog.info('[ok:check table data]') self._query_check(dbname, stbname, f'{ctbname}_1', None, 3, okv, _e, dtype) self._query_check(dbname, stbname, f'{ctbname}_2', None, 2, okv, _e, dtype) self._query_check(dbname, stbname, f'{ctbname}_3', None, 1, okv, _e, dtype) # 2. insert into value by creating sub-table automatically, check tag & value - tdLog.info('ok:insert into value by creating sub-table automatically, check tag & value') + tdLog.info('[ok:insert into value by creating sub-table automatically, check tag & value]') tdSql.execute(f'insert into {dbname}.{ctbname}_1 using {dbname}.{stbname} tags(%s, {okv}) values(now, %s, {okv})' %(_e, _e)) tdSql.execute(f'insert into {dbname}.{ctbname}_2 using {dbname}.{stbname} tags({okv}, %s) values(now + 1s, {okv}, %s)' %(_e, _e)) tdSql.execute(f'insert into {dbname}.{ctbname}_3 using {dbname}.{stbname} tags(%s, %s) values(now + 2s, %s, %s)' %(_e, _e, _e, _e)) @@ -275,7 +295,7 @@ class TDTestCase: self._query_check(dbname, stbname, f'{ctbname}_3', None, 1, okv, _e, dtype) # 3. insert into value by supper-table, check tag & value - tdLog.info('ok:insert into value by supper-table, check tag & value') + tdLog.info('[ok:insert into value by supper-table, check tag & value]') tdSql.execute(f'insert into {dbname}.{stbname}(tbname, t0, t1, ts, c0, c1) values("{ctbname}_1", %s, {okv}, now, %s, {okv})' %(_e, _e)) tdSql.execute(f'insert into {dbname}.{stbname}(tbname, t0, t1, ts, c0, c1) values("{ctbname}_2", {okv}, %s, now + 1s, {okv}, %s)' %(_e, _e)) tdSql.execute(f'insert into {dbname}.{stbname}(tbname, t0, t1, ts, c0, c1) values("{ctbname}_3", %s, %s, now + 2s, %s, %s)' %(_e, _e, _e, _e)) @@ -285,7 +305,7 @@ class TDTestCase: self._query_check(dbname, stbname, f'{ctbname}_3', None, 1, okv, _e, dtype) # 4. insert value into normal table - tdLog.info('ok:insert value into normal table') + tdLog.info('[ok:insert value into normal table]') tdSql.execute(f'insert into {dbname}.{ntbname} values(now, %s, {okv})' %(_e)) tdSql.execute(f'insert into {dbname}.{ntbname} values(now + 1s, {okv}, %s)' %(_e)) tdSql.execute(f'insert into {dbname}.{ntbname} values(now + 2s, %s, %s)' %(_e, _e)) @@ -318,7 +338,7 @@ class TDTestCase: tdSql.query(f'select * from {dbname}.{stbname}') tdSql.checkRows(1) tdSql.execute(f'drop table {dbname}.{ctbname}') - + def __insert_query_exec(self): STR_EMPTY = ['\'\'', "\"\"", '\' \'', "\" \""] STR_CHINESE = ['\'年年岁岁,花相似\''] @@ -351,6 +371,14 @@ class TDTestCase: RAW_INTEGER_P = [' 42 ', '+042 ', ' +0', '0 ', '-0', '0', ' 0X2A', ' -0x0 ', '+0x0 ', ' 0B00101010', ' -0b00'] RAW_INTEGER_M = [' -42 ', ' -0128',' -0x1', ' -0X2A', '-0b01 ', ' -0B00101010 '] + RAW_INTEGER_INT_BOUNDARY_ILLEGAL =['2147483648', '-2147483649'] + RAW_INTEGER_UINT_BOUNDARY_ILLEGAL =['4294967296', '-1'] + RAW_INTEGER_BINT_BOUNDARY_ILLEGAL =['9223372036854775808', '-9223372036854775809'] + RAW_INTEGER_UBINT_BOUNDARY_ILLEGAL =['18446744073709551616', '-1'] + RAW_INTEGER_SINT_BOUNDARY_ILLEGAL =['32768', '-32769'] + RAW_INTEGER_USINT_BOUNDARY_ILLEGAL =['65536', '-1'] + RAW_INTEGER_TINT_BOUNDARY_ILLEGAL =['128', '-129'] + RAW_INTEGER_UTINT_BOUNDARY_ILLEGAL =['256', '-1'] RAW_FLOAT_P = [' 123.012', ' 0.0', ' +0.0', ' -0.0 '] RAW_FLOAT_M = ['-128.001 '] RAW_FLOAT_E_P = [' 1e-100', ' +0.1E+2', ' -0.1E-10'] @@ -390,12 +418,26 @@ class TDTestCase: STR_BINARY_ILLEGAL, STR_BINARY_ILLEGAL, RAW_BINARY_ILLEGAL, RAW_NONE] OK_IN = [STR_INTEGER_P, STR_INTEGER_M, STR_FLOAT_P, STR_FLOAT_M, STR_FLOAT_E_P, STR_FLOAT_E_M, STR_NULL, RAW_INTEGER_P, RAW_INTEGER_M, RAW_FLOAT_P, RAW_FLOAT_M, RAW_FLOAT_E_P, RAW_FLOAT_E_M, RAW_NULL] - KO_IN = [STR_EMPTY, STR_MISC, STR_OPTR, STR_TSK, STR_TSK_MISC, STR_TSKP, STR_TSKP_MISC, STR_BOOL, STR_TS, STR_VARBIN, STR_JSON_O, STR_JSON_A, STR_GEO, RAW_TSK, + BASE_KO_IN = [STR_EMPTY, STR_MISC, STR_OPTR, STR_TSK, STR_TSK_MISC, STR_TSKP, STR_TSKP_MISC, STR_BOOL, STR_TS, STR_VARBIN, STR_JSON_O, STR_JSON_A, STR_GEO, RAW_TSK, RAW_BOOL, RAW_MISC, RAW_OPTR, RAW_TSK_OPTR, RAW_TSKP, RAW_TSKP_OPTR, STR_CHINESE, STR_NONE, STR_BINARY, RAW_NONE] + KO_IN = BASE_KO_IN + [RAW_INTEGER_INT_BOUNDARY_ILLEGAL] + OK_BIN = OK_IN + KO_BIN = BASE_KO_IN + [RAW_INTEGER_BINT_BOUNDARY_ILLEGAL] + OK_SIN = OK_IN + KO_SIN = BASE_KO_IN + [RAW_INTEGER_SINT_BOUNDARY_ILLEGAL] + OK_TIN = OK_IN + KO_TIN = BASE_KO_IN + [RAW_INTEGER_TINT_BOUNDARY_ILLEGAL] OK_UI = [STR_INTEGER_P, STR_FLOAT_P, STR_FLOAT_E_P, STR_NULL, RAW_INTEGER_P, RAW_FLOAT_P, RAW_FLOAT_E_P, RAW_NULL, RAW_FLOAT_E_M_SPE] - KO_UI = [STR_EMPTY, STR_MISC, STR_INTEGER_M, STR_FLOAT_M, STR_FLOAT_E_M, STR_OPTR, STR_TSK, STR_TSK_MISC, STR_TSKP, STR_TSKP_MISC, STR_BOOL, STR_TS, STR_VARBIN, + BASE_KO_UI = [STR_EMPTY, STR_MISC, STR_INTEGER_M, STR_FLOAT_M, STR_FLOAT_E_M, STR_OPTR, STR_TSK, STR_TSK_MISC, STR_TSKP, STR_TSKP_MISC, STR_BOOL, STR_TS, STR_VARBIN, STR_JSON_O, STR_JSON_A, STR_GEO, RAW_TSK, RAW_BOOL, RAW_INTEGER_M, RAW_FLOAT_M, RAW_FLOAT_E_M, RAW_MISC, RAW_OPTR, RAW_TSK_OPTR, RAW_TSKP, RAW_TSKP_OPTR, STR_CHINESE, STR_NONE, RAW_NONE] + KO_UI = BASE_KO_UI + [RAW_INTEGER_UINT_BOUNDARY_ILLEGAL] + OK_UBINT = OK_UI + KO_UBINT = BASE_KO_UI + [RAW_INTEGER_UBINT_BOUNDARY_ILLEGAL] + OK_USINT = OK_UI + KO_USINT = BASE_KO_UI + [RAW_INTEGER_USINT_BOUNDARY_ILLEGAL] + OK_UTINT = OK_UI + KO_UTINT = BASE_KO_UI + [RAW_INTEGER_UTINT_BOUNDARY_ILLEGAL] OK_FL = [RAW_INTEGER_P, STR_INTEGER_P, STR_INTEGER_M, STR_FLOAT_P, STR_FLOAT_M, STR_FLOAT_E_P, STR_FLOAT_E_M, STR_NULL, RAW_INTEGER_M, RAW_FLOAT_P, RAW_FLOAT_M, RAW_FLOAT_E_P, RAW_FLOAT_E_M, RAW_NULL] KO_FL = [STR_EMPTY, STR_MISC, STR_OPTR, STR_TSK, STR_TSK_MISC, STR_TSKP, STR_TSKP_MISC, STR_BOOL, STR_TS, STR_VARBIN, STR_JSON_O, STR_JSON_A, STR_GEO, RAW_TSK, @@ -411,9 +453,6 @@ class TDTestCase: RAW_TSK_OPTR, RAW_TSKP, RAW_TSKP_OPTR, STR_INTEGER_P, STR_INTEGER_M, STR_FLOAT_P, STR_FLOAT_M, STR_FLOAT_E_P, STR_FLOAT_E_M, RAW_INTEGER_P, RAW_INTEGER_M, RAW_FLOAT_P, RAW_FLOAT_M, RAW_FLOAT_E_P, RAW_FLOAT_E_M, STR_CHINESE, STR_NONE, STR_BINARY, RAW_NONE] - # PARAM_LIST = [ - # ["db", "stb_vc", "ctb_vc", "ntb_vc", OK_VC, KO_VC, "\'vc\'", TDDataType.VARCHAR] - # ] PARAM_LIST = [ ["db", "stb_vc", "ctb_vc", "ntb_vc", OK_VC, KO_VC, "\'vc\'", TDDataType.VARCHAR], @@ -422,8 +461,16 @@ class TDTestCase: ["db", "stb_ts", "ctb_ts", "ntb_ts", OK_TS, KO_TS, "now", TDDataType.TIMESTAMP], ["db", "stb_bo", "ctb_bo", "ntb_bo", OK_BO, KO_BO, "true", TDDataType.BOOL], ["db", "stb_vb", "ctb_vb", "ntb_vb", OK_VB, KO_VB, "\'\\x12\'", TDDataType.VARBINARY], - ["db", "stb_in", "ctb_in", "ntb_in", OK_IN, KO_IN, "-1", TDDataType.UINT], + + ["db", "stb_in", "ctb_in", "ntb_in", OK_IN, KO_IN, "-1", TDDataType.INT], ["db", "stb_ui", "ctb_ui", "ntb_ui", OK_UI, KO_UI, "1", TDDataType.UINT], + ["db", "stb_bin", "ctb_bin", "ntb_bin", OK_BIN, KO_BIN, "-1", TDDataType.BIGINT], + ["db", "stb_bui", "ctb_bui", "ntb_bui", OK_UBINT, KO_UBINT, "1", TDDataType.UBIGINT], + ["db", "stb_sin", "ctb_sin", "ntb_sin", OK_SIN, KO_SIN, "-1", TDDataType.SMALLINT], + ["db", "stb_sui", "ctb_sui", "ntb_sui", OK_USINT, KO_USINT, "1", TDDataType.USMALLINT], + ["db", "stb_tin", "ctb_tin", "ntb_tin", OK_TIN, KO_TIN, "-1", TDDataType.TINYINT], + ["db", "stb_tui", "ctb_tui", "ntb_tui", OK_UTINT, KO_UTINT, "1", TDDataType.UTINYINT], + ["db", "stb_fl", "ctb_fl", "ntb_fl", OK_FL, KO_FL, "1.0", TDDataType.FLOAT], ["db", "stb_db", "ctb_db", "ntb_db", OK_DB, KO_DB, "1.0", TDDataType.DOUBLE], ["db", "stb_ge", "ctb_ge", "ntb_ge", OK_GE, KO_GE, "\'POINT(1.0 1.0)\'", TDDataType.GEOMETRY] @@ -437,8 +484,6 @@ class TDTestCase: def run(self): - tdLog.printNoPrefix("==========step1:create table") - self.__create_tb() self.__insert_query_exec() From cba77f9f728c272cd7080c2aceb43b7ebf643a3c Mon Sep 17 00:00:00 2001 From: Chris Zhai Date: Fri, 22 Mar 2024 14:31:15 +0800 Subject: [PATCH 4/4] update test cases for ts-4221- v5 --- tests/pytest/util/sql.py | 13 +- .../1-insert/insert_column_value.py | 154 +++++++++++------- 2 files changed, 102 insertions(+), 65 deletions(-) diff --git a/tests/pytest/util/sql.py b/tests/pytest/util/sql.py index 783009b3fb..d1ffaaca92 100644 --- a/tests/pytest/util/sql.py +++ b/tests/pytest/util/sql.py @@ -85,7 +85,6 @@ class TDSql: i=1 while i <= queryTimes: try: - tdLog.info(sql) self.affectedRows = self.cursor.execute(sql) return self.affectedRows except Exception as e: @@ -116,12 +115,14 @@ class TDSql: else: tdLog.info("sql:%s, check passed, no ErrInfo occurred" % (sql)) - def error(self, sql, expectedErrno = None, expectErrInfo = None, fullMatched = True): + def error(self, sql, expectedErrno = None, expectErrInfo = None, fullMatched = True, show = False): caller = inspect.getframeinfo(inspect.stack()[1][0]) expectErrNotOccured = True - try: + if show: tdLog.info("sql:%s" % (sql)) + + try: self.cursor.execute(sql) except BaseException as e: tdLog.info("err:%s" % (e)) @@ -164,12 +165,14 @@ class TDSql: return self.error_info - def query(self, sql, row_tag=None, queryTimes=10, count_expected_res=None): + def query(self, sql, row_tag=None, queryTimes=10, count_expected_res=None, show = False): + if show: + tdLog.info("sql:%s" % (sql)) + self.sql = sql i=1 while i <= queryTimes: try: - tdLog.info(sql) self.cursor.execute(sql) self.queryResult = self.cursor.fetchall() self.queryRows = len(self.queryResult) diff --git a/tests/system-test/1-insert/insert_column_value.py b/tests/system-test/1-insert/insert_column_value.py index 696401fd6a..fcb83e2f97 100644 --- a/tests/system-test/1-insert/insert_column_value.py +++ b/tests/system-test/1-insert/insert_column_value.py @@ -1,5 +1,6 @@ import datetime, time from enum import Enum +import binascii from util.log import * from util.sql import * from util.cases import * @@ -178,6 +179,37 @@ class TDTestCase: check_result = True tdSql.checkEqual(check_result, True) + def _query_check_varbinary(self, result, okv, nv, row = 0, col = 0): + tdLog.info(f'[okv={okv}, nv={nv}') + for i in range(row): + for j in range(1, col): + check_result = False + if result[i][j]: + check_item = result[i][j].decode('utf-8') + else: + check_item = '' + # new_nv = None + + if nv[0:1] == '\'' or nv[0:1] == '\"': + nv = nv[1:-1] + if okv[0:1] == '\'' or okv[0:1] == '\"': + okv = okv[1:-1] + + # if nv[0:2] == '\\x' or nv[0:2] == '\\X': + # nv = nv[1:] + # elif nv == '' or nv =="": + # new_nv = nv + # elif nv.isspace(): + # new_nv = nv + # else: + # hex_text = binascii.hexlify(nv.encode()) + # new_nv = '/x' + hex_text.decode().upper() + # tdLog.info(f"okv={okv}, nv={nv}, check_item={check_item}") + if check_item == None: + check_item = 'null' + if check_item in okv or check_item in nv: + check_result = True + tdSql.checkEqual(check_result, True) def _query_check(self, dbname="db", stbname="", ctbname="", ntbname="",nRows = 0, okv = None, nv = None, dtype = TDDataType.NULL): result = None @@ -192,17 +224,17 @@ class TDTestCase: result = tdSql.queryResult - if dtype == TDDataType.VARCHAR or dtype == TDDataType.NCHAR: + if dtype == TDDataType.VARCHAR or dtype == TDDataType.NCHAR or dtype == TDDataType.BINARY: self._query_check_varchar(result, okv, nv, nRows, 4) elif dtype == TDDataType.TIMESTAMP: self._query_check_timestamp(result, okv, nv, nRows, 4) elif dtype == TDDataType.BOOL: self._query_check_bool(result, okv, nv, nRows, 4) elif dtype == TDDataType.VARBINARY: - pass - elif dtype == TDDataType.INT: + self._query_check_varbinary(result, okv, nv, nRows, 4) + elif dtype == TDDataType.INT or dtype == TDDataType.BIGINT or dtype == TDDataType.SMALLINT or dtype == TDDataType.TINYINT: self._query_check_int(result, okv, nv, nRows, 4) - elif dtype == TDDataType.UINT: + elif dtype == TDDataType.UINT or dtype == TDDataType.UBIGINT or dtype == TDDataType.USMALLINT or dtype == TDDataType.UTINYINT: self._query_check_int(result, okv, nv, nRows, 4) elif dtype == TDDataType.FLOAT or dtype == TDDataType.DOUBLE: self._query_check_int(result, okv, nv, nRows, 4) @@ -220,63 +252,65 @@ class TDTestCase: for _l in kolist: for _e in _l: + # tdLog.info(f'[ko:verify value "{_e}"]') # create sub-table manually, check tag tdLog.info('[ko:create sub-table manually, check tag]') - tdSql.error(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags(%s, {okv})' %(_e)) - tdSql.error(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, %s)' %(_e)) - # tdSql.error(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags(%s, %s)' %(_e, _e)) + tdSql.error(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags(%s, {okv})' %(_e), show=True) + tdSql.error(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, %s)' %(_e), show=True) + tdSql.error(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags(%s, %s)' %(_e, _e), show=True) # create sub-table automatically, check tag tdLog.info('[ko:create sub-table automatically, check tag]') - tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, %s) values(now, {okv}, {okv})' %(_e)) - tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags(%s, {okv}) values(now, {okv}, {okv})' %(_e)) + tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, %s) values(now, {okv}, {okv})' %(_e), show=True) + tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags(%s, {okv}) values(now, {okv}, {okv})' %(_e), show=True) # create sub-table automatically, check value tdLog.info('[ko:create sub-table automatically, check value]') - tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, {okv}) values(now, %s, {okv})' %(_e)) - tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, {okv}) values(now, {okv}, %s)' %(_e)) - # tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, {okv}) values(now, %s, %s)' %(_e, _e)) + tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, {okv}) values(now, %s, {okv})' %(_e), show=True) + tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, {okv}) values(now, {okv}, %s)' %(_e), show=True) + tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, {okv}) values(now, %s, %s)' %(_e, _e), show=True) # check alter table tag tdLog.info('[ko:check alter table tag]') - tdSql.execute(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, {okv}) values(now, {okv}, {okv})') - self._query_check(dbname,stbname, "", None, 1, okv, _e, dtype) - tdSql.execute(f'alter table {dbname}.{ctbname} set tag t0 = {okv}') - tdSql.error(f'alter table {dbname}.{ctbname} set tag t0 = %s' %(_e)) - tdSql.error(f'alter table {dbname}.{ctbname} set tag t1 = %s' %(_e)) + tdSql.execute(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, {okv}) values(now, {okv}, {okv})', show=True) + # self._query_check(dbname,stbname, "", None, 1, okv, _e, dtype) + # tdSql.execute(f'alter table {dbname}.{ctbname} set tag t0 = {okv}', show=True) + tdSql.error(f'alter table {dbname}.{ctbname} set tag t0 = %s' %(_e), show=True) + tdSql.error(f'alter table {dbname}.{ctbname} set tag t1 = %s' %(_e), show=True) tdSql.execute(f'drop table {dbname}.{ctbname}') # insert into value by supper-table, check tag & value tdLog.info('[ko:insert into value by supper-table, check tag & value]') - tdSql.error(f'insert into {dbname}.{stbname}(tbname, t0, t1, ts, c0, c1) values("{ctbname}_1", %s, {okv}, now, {okv}, {okv})' %(_e)) - tdSql.error(f'insert into {dbname}.{stbname}(tbname, t0, t1, ts, c0, c1) values("{ctbname}_2", {okv},{okv}, now + 1s, {okv}, %s)' %(_e)) - # tdSql.error(f'insert into {dbname}.{stbname}(tbname, t0, t1, ts, c0, c1) values("{ctbname}_3", %s, %s, now + 2s, %s, %s)' %(_e, _e, _e, _e)) + tdSql.error(f'insert into {dbname}.{stbname}(tbname, t0, t1, ts, c0, c1) values("{ctbname}_1", %s, {okv}, now, {okv}, {okv})' %(_e), show=True) + tdSql.error(f'insert into {dbname}.{stbname}(tbname, t0, t1, ts, c0, c1) values("{ctbname}_2", {okv},{okv}, now + 1s, {okv}, %s)' %(_e), show=True) + tdSql.error(f'insert into {dbname}.{stbname}(tbname, t0, t1, ts, c0, c1) values("{ctbname}_3", %s, %s, now + 2s, %s, %s)' %(_e, _e, _e, _e), show=True) # insert into normal table, check value tdLog.info('[ko:insert into normal table, check value]') - tdSql.error(f'insert into {dbname}.{ntbname} values(now, %s, {okv})' %(_e)) - tdSql.error(f'insert into {dbname}.{ntbname} values(now, {okv}, %s)' %(_e)) - # tdSql.error(f'insert into {dbname}.{ntbname} values(now, %s, %s)' %(_e, _e)) + tdSql.error(f'insert into {dbname}.{ntbname} values(now, %s, {okv})' %(_e), show=True) + tdSql.error(f'insert into {dbname}.{ntbname} values(now, {okv}, %s)' %(_e), show=True) + tdSql.error(f'insert into {dbname}.{ntbname} values(now, %s, %s)' %(_e, _e), show=True) for _l in oklist: for _e in _l: + tdLog.info(f'[ok:verify value "{_e}"]') # 1. create sub-table manually, check tag tdLog.info('[ok:create sub-table manually, check tag]') - tdSql.execute(f'create table {dbname}.{ctbname}_1 using {dbname}.{stbname} tags(%s, {okv})' %(_e)) - tdSql.execute(f'create table {dbname}.{ctbname}_2 using {dbname}.{stbname} tags({okv}, %s)' %(_e)) - tdSql.execute(f'create table {dbname}.{ctbname}_3 using {dbname}.{stbname} tags(%s, %s)' %(_e, _e)) + tdSql.execute(f'create table {dbname}.{ctbname}_1 using {dbname}.{stbname} tags({_e}, {okv})', show=True) + tdSql.execute(f'create table {dbname}.{ctbname}_2 using {dbname}.{stbname} tags({okv}, %s)' %(_e), show=True) + tdSql.execute(f'create table {dbname}.{ctbname}_3 using {dbname}.{stbname} tags(%s, %s)' %(_e, _e), show=True) # 1.1 insert into sub-table, check value tdLog.info('[ok:insert into sub-table, check value]') - tdSql.execute(f'insert into {dbname}.{ctbname}_1 values(now + 0s, %s, {okv})' %(_e)) - tdSql.execute(f'insert into {dbname}.{ctbname}_2 values(now + 1s, {okv}, %s)' %(_e)) - tdSql.execute(f'insert into {dbname}.{ctbname}_3 values(now + 2s, %s, %s)' %(_e, _e)) + tdSql.execute(f'insert into {dbname}.{ctbname}_1 values(now + 0s, %s, {okv})' %(_e), show=True) + tdSql.execute(f'insert into {dbname}.{ctbname}_2 values(now + 1s, {okv}, %s)' %(_e), show=True) + tdSql.execute(f'insert into {dbname}.{ctbname}_3 values(now + 2s, %s, %s)' %(_e, _e), show=True) # 1.2 check alter table tag tdLog.info('[ok:check alter table tag]') - tdSql.execute(f'alter table {dbname}.{ctbname}_1 set tag t1 = %s' %(_e)) - tdSql.execute(f'alter table {dbname}.{ctbname}_2 set tag t0 = %s' %(_e)) + tdSql.execute(f'alter table {dbname}.{ctbname}_1 set tag t1 = %s' %(_e), show=True) + tdSql.execute(f'alter table {dbname}.{ctbname}_2 set tag t0 = %s' %(_e), show=True) # 1.3 check table data tdLog.info('[ok:check table data]') @@ -286,9 +320,9 @@ class TDTestCase: # 2. insert into value by creating sub-table automatically, check tag & value tdLog.info('[ok:insert into value by creating sub-table automatically, check tag & value]') - tdSql.execute(f'insert into {dbname}.{ctbname}_1 using {dbname}.{stbname} tags(%s, {okv}) values(now, %s, {okv})' %(_e, _e)) - tdSql.execute(f'insert into {dbname}.{ctbname}_2 using {dbname}.{stbname} tags({okv}, %s) values(now + 1s, {okv}, %s)' %(_e, _e)) - tdSql.execute(f'insert into {dbname}.{ctbname}_3 using {dbname}.{stbname} tags(%s, %s) values(now + 2s, %s, %s)' %(_e, _e, _e, _e)) + tdSql.execute(f'insert into {dbname}.{ctbname}_1 using {dbname}.{stbname} tags(%s, {okv}) values(now, %s, {okv})' %(_e, _e), show=True) + tdSql.execute(f'insert into {dbname}.{ctbname}_2 using {dbname}.{stbname} tags({okv}, %s) values(now + 1s, {okv}, %s)' %(_e, _e), show=True) + tdSql.execute(f'insert into {dbname}.{ctbname}_3 using {dbname}.{stbname} tags(%s, %s) values(now + 2s, %s, %s)' %(_e, _e, _e, _e), show=True) self._query_check(dbname, stbname, f'{ctbname}_1', None, 3, okv, _e, dtype) self._query_check(dbname, stbname, f'{ctbname}_2', None, 2, okv, _e, dtype) @@ -296,9 +330,9 @@ class TDTestCase: # 3. insert into value by supper-table, check tag & value tdLog.info('[ok:insert into value by supper-table, check tag & value]') - tdSql.execute(f'insert into {dbname}.{stbname}(tbname, t0, t1, ts, c0, c1) values("{ctbname}_1", %s, {okv}, now, %s, {okv})' %(_e, _e)) - tdSql.execute(f'insert into {dbname}.{stbname}(tbname, t0, t1, ts, c0, c1) values("{ctbname}_2", {okv}, %s, now + 1s, {okv}, %s)' %(_e, _e)) - tdSql.execute(f'insert into {dbname}.{stbname}(tbname, t0, t1, ts, c0, c1) values("{ctbname}_3", %s, %s, now + 2s, %s, %s)' %(_e, _e, _e, _e)) + tdSql.execute(f'insert into {dbname}.{stbname}(tbname, t0, t1, ts, c0, c1) values("{ctbname}_1", %s, {okv}, now, %s, {okv})' %(_e, _e), show=True) + tdSql.execute(f'insert into {dbname}.{stbname}(tbname, t0, t1, ts, c0, c1) values("{ctbname}_2", {okv}, %s, now + 1s, {okv}, %s)' %(_e, _e), show=True) + tdSql.execute(f'insert into {dbname}.{stbname}(tbname, t0, t1, ts, c0, c1) values("{ctbname}_3", %s, %s, now + 2s, %s, %s)' %(_e, _e, _e, _e), show=True) self._query_check(dbname, stbname, f'{ctbname}_1', None, 3, okv, _e, dtype) self._query_check(dbname, stbname, f'{ctbname}_2', None, 2, okv, _e, dtype) @@ -306,9 +340,9 @@ class TDTestCase: # 4. insert value into normal table tdLog.info('[ok:insert value into normal table]') - tdSql.execute(f'insert into {dbname}.{ntbname} values(now, %s, {okv})' %(_e)) - tdSql.execute(f'insert into {dbname}.{ntbname} values(now + 1s, {okv}, %s)' %(_e)) - tdSql.execute(f'insert into {dbname}.{ntbname} values(now + 2s, %s, %s)' %(_e, _e)) + tdSql.execute(f'insert into {dbname}.{ntbname} values(now, %s, {okv})' %(_e), show=True) + tdSql.execute(f'insert into {dbname}.{ntbname} values(now + 1s, {okv}, %s)' %(_e), show=True) + tdSql.execute(f'insert into {dbname}.{ntbname} values(now + 2s, %s, %s)' %(_e, _e), show=True) if dtype != TDDataType.GEOMETRY: # self._query_check(dbname, None, None, ntbname, 3, okv, _e, dtype) @@ -322,22 +356,22 @@ class TDTestCase: for _l in kolist: for _e in _l: - tdSql.error(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags(%s)' %(_e)) - tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags(%s) values(now, 1)' %(_e)) - tdSql.execute(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}) values(now, 1)') - tdSql.query(f'select * from {dbname}.{stbname}') + tdSql.error(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags(%s)' %(_e), show=True) + tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags(%s) values(now, 1)' %(_e), show=True) + tdSql.execute(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}) values(now, 1)', show=True) + tdSql.query(f'select * from {dbname}.{stbname}', show=True) tdSql.checkRows(1) - tdSql.execute(f'alter table {dbname}.{ctbname} set tag t0 = {okv}') - tdSql.error(f'alter table {dbname}.{ctbname} set tag t0 = %s' %(_e)) - tdSql.execute(f'drop table {dbname}.{ctbname}') + tdSql.execute(f'alter table {dbname}.{ctbname} set tag t0 = {okv}', show=True) + tdSql.error(f'alter table {dbname}.{ctbname} set tag t0 = %s' %(_e), show=True) + tdSql.execute(f'drop table {dbname}.{ctbname}', show=True) for _l in oklist: for _e in _l: - tdSql.execute(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags(%s)' %(_e)) - tdSql.execute(f'insert into {dbname}.{ctbname} values(now, 1)') - tdSql.execute(f'alter table {dbname}.{ctbname} set tag t0 = %s' %(_e)) - tdSql.query(f'select * from {dbname}.{stbname}') + tdSql.execute(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags(%s)' %(_e), show=True) + tdSql.execute(f'insert into {dbname}.{ctbname} values(now, 1)', show=True) + tdSql.execute(f'alter table {dbname}.{ctbname} set tag t0 = %s' %(_e), show=True) + tdSql.query(f'select * from {dbname}.{stbname}', show=True) tdSql.checkRows(1) - tdSql.execute(f'drop table {dbname}.{ctbname}') + tdSql.execute(f'drop table {dbname}.{ctbname}', show=True) def __insert_query_exec(self): STR_EMPTY = ['\'\'', "\"\"", '\' \'', "\" \""] @@ -359,15 +393,15 @@ class TDTestCase: STR_BOOL = ['\'true\'', '\'false\'', '\'TRUE\'', '\'FALSE\'', '\'tRuE\'', '\'falsE\''] STR_TS = ["\"2024-02-01 00:00:01.001-08:00\"", "\'2024-02-01T00:00:01.001+09:00\'", "\"2024-02-01\"", "\'2024-02-02 00:00:01\'", "\'2024-02-02 00:00:01.009\'"] STR_TS_ILLEGAL = ["\"2023-2024-02-01 00:00:01.001-08:00\"", "\'2024-02-01T99:00:01.001+09:00\'", "\"2024-02-31\"", "\'2024-02-02 00:88:01\'", "\'2024-02-02 00:00:77.009\'"] - STR_VARBIN = ['\'\\x12\'', '\'\\x13\'', '\' \\x14 \'', '\'\\x12ab\''] + STR_VARBIN = ["\'\x12\'", "\'\x13\'", "\' \x14 \'", "\'\x12ab\'"] STR_JSON_O = ['\'{\"k1\":\"v1\"}\'', '\' {} \''] STR_JSON_A = ['\'[]\'', '\"{\'k1\': \'v1\',\'k2\'}\"', '\"{\'k1\': \'v1\'}}\"'] - STR_GEO = ['\' POINT(1.0 1.0)\'', '\'LINESTRING(1.00 +2.0, 2.1 -3.2, 5.00 5.01) \'', '\'POLYGON((1.0 1.0, -2.0 +2.0, 1.0 1.0))\'' ] + STR_GEO = ["\' POINT(1.0 1.0)\'", "\'LINESTRING(1.00 +2.0, 2.1 -3.2, 5.00 5.01) \'", "\'POLYGON((1.0 1.0, -2.0 +2.0, 1.0 1.0))\'" ] STR_GEO_ILLEGAL = ['\' POINT(1.0)\'', '\'LINESTRING(1.00 +2.0, -3.2, 5.00 5.01) \'', '\'POLYGON((-2.0 +2.0, 1.0 1.0))\'' ] STR_NULL = ['\'NuLl\'', '\'null\'', '\'NULL\''] STR_NONE = ['\'NoNe\'', '\'none\'', '\'NONE\''] - STR_BINARY = ['\'\\x7f8290\'', '\'\\X7f8290\'', '\'x7f8290\'', '\'\\x\''] # bug TD-29193 - STR_BINARY_ILLEGAL = ['\'\\x7f829\''] + STR_BINARY = ["\'\x7f8290\'", "\'\X7f8290\'", "\'x7f8290\'", "\'\\x\'"] # bug TD-29193 + STR_BINARY_ILLEGAL = ["\'\\x7f829\'"] RAW_INTEGER_P = [' 42 ', '+042 ', ' +0', '0 ', '-0', '0', ' 0X2A', ' -0x0 ', '+0x0 ', ' 0B00101010', ' -0b00'] RAW_INTEGER_M = [' -42 ', ' -0128',' -0x1', ' -0X2A', '-0b01 ', ' -0B00101010 '] @@ -413,7 +447,7 @@ class TDTestCase: KO_BO = [STR_EMPTY, STR_TSK, STR_TSKP, STR_TS, STR_MISC, STR_OPTR, STR_TSK_MISC, STR_TSKP_MISC, STR_VARBIN, STR_JSON_O, STR_JSON_A, STR_GEO, RAW_TSK, RAW_TSK_OPTR, RAW_TSKP, RAW_TSKP_OPTR, RAW_MISC, RAW_OPTR, STR_CHINESE, STR_NONE, STR_BINARY, RAW_NONE] OK_VB = [STR_EMPTY, STR_INTEGER_P, STR_INTEGER_M, STR_FLOAT_P, STR_FLOAT_M, STR_FLOAT_E_P, STR_FLOAT_E_M, STR_MISC, STR_OPTR, STR_TSK, STR_TSK_MISC, STR_TSKP, - STR_TSKP_MISC, STR_BOOL, STR_TS, STR_VARBIN, STR_JSON_O, STR_JSON_A, STR_GEO, STR_NULL, RAW_NULL, STR_CHINESE, STR_NONE, STR_BINARY] + STR_TSKP_MISC, STR_BOOL, STR_TS, STR_VARBIN, STR_JSON_O, STR_JSON_A, STR_GEO, STR_NULL, RAW_NULL, STR_CHINESE, STR_NONE, STR_BINARY] KO_VB = [RAW_INTEGER_P, RAW_INTEGER_M, RAW_FLOAT_P, RAW_FLOAT_M, RAW_FLOAT_E_P, RAW_FLOAT_E_M, RAW_TSK, RAW_BOOL, RAW_MISC, RAW_OPTR, RAW_TSK_OPTR, RAW_TSKP, RAW_TSKP_OPTR, STR_BINARY_ILLEGAL, STR_BINARY_ILLEGAL, RAW_BINARY_ILLEGAL, RAW_NONE] OK_IN = [STR_INTEGER_P, STR_INTEGER_M, STR_FLOAT_P, STR_FLOAT_M, STR_FLOAT_E_P, STR_FLOAT_E_M, STR_NULL, RAW_INTEGER_P, RAW_INTEGER_M, RAW_FLOAT_P, RAW_FLOAT_M, @@ -453,14 +487,14 @@ class TDTestCase: RAW_TSK_OPTR, RAW_TSKP, RAW_TSKP_OPTR, STR_INTEGER_P, STR_INTEGER_M, STR_FLOAT_P, STR_FLOAT_M, STR_FLOAT_E_P, STR_FLOAT_E_M, RAW_INTEGER_P, RAW_INTEGER_M, RAW_FLOAT_P, RAW_FLOAT_M, RAW_FLOAT_E_P, RAW_FLOAT_E_M, STR_CHINESE, STR_NONE, STR_BINARY, RAW_NONE] - + TEST = [["' POINT(1.0 1.0)'"]] PARAM_LIST = [ ["db", "stb_vc", "ctb_vc", "ntb_vc", OK_VC, KO_VC, "\'vc\'", TDDataType.VARCHAR], ["db", "stb_nc", "ctb_nc", "ntb_nc", OK_NC, KO_NC, "\'nc\'", TDDataType.NCHAR], ["db", "stb_bi", "ctb_bi", "ntb_bi", OK_BI, KO_BI, "\'bi\'", TDDataType.BINARY], ["db", "stb_ts", "ctb_ts", "ntb_ts", OK_TS, KO_TS, "now", TDDataType.TIMESTAMP], ["db", "stb_bo", "ctb_bo", "ntb_bo", OK_BO, KO_BO, "true", TDDataType.BOOL], - ["db", "stb_vb", "ctb_vb", "ntb_vb", OK_VB, KO_VB, "\'\\x12\'", TDDataType.VARBINARY], + ["db", "stb_vb", "ctb_vb", "ntb_vb", OK_VB, KO_VB, "'hello'", TDDataType.VARBINARY], ["db", "stb_in", "ctb_in", "ntb_in", OK_IN, KO_IN, "-1", TDDataType.INT], ["db", "stb_ui", "ctb_ui", "ntb_ui", OK_UI, KO_UI, "1", TDDataType.UINT], @@ -473,7 +507,7 @@ class TDTestCase: ["db", "stb_fl", "ctb_fl", "ntb_fl", OK_FL, KO_FL, "1.0", TDDataType.FLOAT], ["db", "stb_db", "ctb_db", "ntb_db", OK_DB, KO_DB, "1.0", TDDataType.DOUBLE], - ["db", "stb_ge", "ctb_ge", "ntb_ge", OK_GE, KO_GE, "\'POINT(1.0 1.0)\'", TDDataType.GEOMETRY] + ["db", "stb_ge", "ctb_ge", "ntb_ge", TEST, KO_GE, "\'POINT(100.0 100.0)\'", TDDataType.GEOMETRY] ] # check with common function