From bf8b149a5be459eff1dfe9879236da82c7f57d6a Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Mon, 17 Jan 2022 10:11:02 +0800 Subject: [PATCH] [TD-12945](query): taos shell crash when constant comparison cause crash --- .../develop-test/2-query/constant_compare.py | 316 +++++++++--------- 1 file changed, 158 insertions(+), 158 deletions(-) diff --git a/tests/develop-test/2-query/constant_compare.py b/tests/develop-test/2-query/constant_compare.py index 9bf520c942..a8ca27e63c 100644 --- a/tests/develop-test/2-query/constant_compare.py +++ b/tests/develop-test/2-query/constant_compare.py @@ -135,20 +135,20 @@ class TDTestCase: tdSql.checkRows(1) tdSql.checkData(0, 0, 1) - tdSql.error('select "abc" = "def"') - tdSql.error('select "abc" = 1') - tdSql.error('select 1 = "abc"') - tdSql.error('select "abc" = 1.0') - tdSql.error('select 1.0 = "abc"') - tdSql.error('select "abc" = true') - tdSql.error('select false = "abc"') - tdSql.error('select \'abc\' = \'def\'') - tdSql.error('select \'abc\' = 1') - tdSql.error('select 1 = \'abc\'') - tdSql.error('select \'abc\' = 1.0') - tdSql.error('select 1.0 = \'abc\'') - tdSql.error('select \'abc\' = true') - tdSql.error('select false = \'abc\'') + tdSql.error('select "abc" = "def" from tb;') + tdSql.error('select "abc" = 1 from tb;') + tdSql.error('select 1 = "abc" from tb;') + tdSql.error('select "abc" = 1.0 from tb;') + tdSql.error('select 1.0 = "abc" from tb;') + tdSql.error('select "abc" = true from tb;') + tdSql.error('select false = "abc" from tb;') + tdSql.error('select \'abc\' = \'def\' from tb;') + tdSql.error('select \'abc\' = 1 from tb;') + tdSql.error('select 1 = \'abc\' from tb;') + tdSql.error('select \'abc\' = 1.0 from tb;') + tdSql.error('select 1.0 = \'abc\' from tb;') + tdSql.error('select \'abc\' = true from tb;') + tdSql.error('select false = \'abc\' from tb;') ##operator: != @@ -232,20 +232,20 @@ class TDTestCase: tdSql.checkRows(1) tdSql.checkData(0, 0, 0) - tdSql.error('select "abc" != "def"') - tdSql.error('select "abc" != 1') - tdSql.error('select 1 != "abc"') - tdSql.error('select "abc" != 1.0') - tdSql.error('select 1.0 != "abc"') - tdSql.error('select "abc" != true') - tdSql.error('select false != "abc"') - tdSql.error('select \'abc\' != \'def\'') - tdSql.error('select \'abc\' != 1') - tdSql.error('select 1 != \'abc\'') - tdSql.error('select \'abc\' != 1.0') - tdSql.error('select 1.0 != \'abc\'') - tdSql.error('select \'abc\' != true') - tdSql.error('select false != \'abc\'') + tdSql.error('select "abc" != "def" from tb;') + tdSql.error('select "abc" != 1 from tb;') + tdSql.error('select 1 != "abc" from tb;') + tdSql.error('select "abc" != 1.0 from tb;') + tdSql.error('select 1.0 != "abc" from tb;') + tdSql.error('select "abc" != true from tb;') + tdSql.error('select false != "abc" from tb;') + tdSql.error('select \'abc\' != \'def\' from tb;') + tdSql.error('select \'abc\' != 1 from tb;') + tdSql.error('select 1 != \'abc\' from tb;') + tdSql.error('select \'abc\' != 1.0 from tb;') + tdSql.error('select 1.0 != \'abc\' from tb;') + tdSql.error('select \'abc\' != true from tb;') + tdSql.error('select false != \'abc\' from tb;') ##operator: <> tdSql.query('select 1 <> 1 from tb;') @@ -328,20 +328,20 @@ class TDTestCase: tdSql.checkRows(1) tdSql.checkData(0, 0, 0) - tdSql.error('select "abc" <> "def"') - tdSql.error('select "abc" <> 1') - tdSql.error('select 1 <> "abc"') - tdSql.error('select "abc" <> 1.0') - tdSql.error('select 1.0 <> "abc"') - tdSql.error('select "abc" <> true') - tdSql.error('select false <> "abc"') - tdSql.error('select \'abc\' <> \'def\'') - tdSql.error('select \'abc\' <> 1') - tdSql.error('select 1 <> \'abc\'') - tdSql.error('select \'abc\' <> 1.0') - tdSql.error('select 1.0 <> \'abc\'') - tdSql.error('select \'abc\' <> true') - tdSql.error('select false <> \'abc\'') + tdSql.error('select "abc" <> "def" from tb;') + tdSql.error('select "abc" <> 1 from tb;') + tdSql.error('select 1 <> "abc" from tb;') + tdSql.error('select "abc" <> 1.0 from tb;') + tdSql.error('select 1.0 <> "abc" from tb;') + tdSql.error('select "abc" <> true from tb;') + tdSql.error('select false <> "abc" from tb;') + tdSql.error('select \'abc\' <> \'def\' from tb;') + tdSql.error('select \'abc\' <> 1 from tb;') + tdSql.error('select 1 <> \'abc\' from tb;') + tdSql.error('select \'abc\' <> 1.0 from tb;') + tdSql.error('select 1.0 <> \'abc\' from tb;') + tdSql.error('select \'abc\' <> true from tb;') + tdSql.error('select false <> \'abc\' from tb;') ##operator: < tdSql.query('select 1 < 1 from tb;') @@ -424,20 +424,20 @@ class TDTestCase: tdSql.checkRows(1) tdSql.checkData(0, 0, 0) - tdSql.error('select "abc" < "def"') - tdSql.error('select "abc" < 1') - tdSql.error('select 1 < "abc"') - tdSql.error('select "abc" < 1.0') - tdSql.error('select 1.0 < "abc"') - tdSql.error('select "abc" < true') - tdSql.error('select false < "abc"') - tdSql.error('select \'abc\' < \'def\'') - tdSql.error('select \'abc\' < 1') - tdSql.error('select 1 < \'abc\'') - tdSql.error('select \'abc\' < 1.0') - tdSql.error('select 1.0 < \'abc\'') - tdSql.error('select \'abc\' < true') - tdSql.error('select false < \'abc\'') + tdSql.error('select "abc" < "def" from tb;') + tdSql.error('select "abc" < 1 from tb;') + tdSql.error('select 1 < "abc" from tb;') + tdSql.error('select "abc" < 1.0 from tb;') + tdSql.error('select 1.0 < "abc" from tb;') + tdSql.error('select "abc" < true from tb;') + tdSql.error('select false < "abc" from tb;') + tdSql.error('select \'abc\' < \'def\' from tb;') + tdSql.error('select \'abc\' < 1 from tb;') + tdSql.error('select 1 < \'abc\' from tb;') + tdSql.error('select \'abc\' < 1.0 from tb;') + tdSql.error('select 1.0 < \'abc\' from tb;') + tdSql.error('select \'abc\' < true from tb;') + tdSql.error('select false < \'abc\' from tb;') ##operator: > tdSql.query('select 1 > 1 from tb;') @@ -520,20 +520,20 @@ class TDTestCase: tdSql.checkRows(1) tdSql.checkData(0, 0, 0) - tdSql.error('select "abc" > "def"') - tdSql.error('select "abc" > 1') - tdSql.error('select 1 > "abc"') - tdSql.error('select "abc" > 1.0') - tdSql.error('select 1.0 > "abc"') - tdSql.error('select "abc" > true') - tdSql.error('select false > "abc"') - tdSql.error('select \'abc\' > \'def\'') - tdSql.error('select \'abc\' > 1') - tdSql.error('select 1 > \'abc\'') - tdSql.error('select \'abc\' > 1.0') - tdSql.error('select 1.0 > \'abc\'') - tdSql.error('select \'abc\' > true') - tdSql.error('select false > \'abc\'') + tdSql.error('select "abc" > "def" from tb;') + tdSql.error('select "abc" > 1 from tb;') + tdSql.error('select 1 > "abc" from tb;') + tdSql.error('select "abc" > 1.0 from tb;') + tdSql.error('select 1.0 > "abc" from tb;') + tdSql.error('select "abc" > true from tb;') + tdSql.error('select false > "abc" from tb;') + tdSql.error('select \'abc\' > \'def\' from tb;') + tdSql.error('select \'abc\' > 1 from tb;') + tdSql.error('select 1 > \'abc\' from tb;') + tdSql.error('select \'abc\' > 1.0 from tb;') + tdSql.error('select 1.0 > \'abc\' from tb;') + tdSql.error('select \'abc\' > true from tb;') + tdSql.error('select false > \'abc\' from tb;') ##operator: <= tdSql.query('select 1 <= 2 from tb;') @@ -636,20 +636,20 @@ class TDTestCase: tdSql.checkRows(1) tdSql.checkData(0, 0, 1) - tdSql.error('select "abc" <= "def"') - tdSql.error('select "abc" <= 1') - tdSql.error('select 1 <= "abc"') - tdSql.error('select "abc" <= 1.0') - tdSql.error('select 1.0 <= "abc"') - tdSql.error('select "abc" <= true') - tdSql.error('select false <= "abc"') - tdSql.error('select \'abc\' <= \'def\'') - tdSql.error('select \'abc\' <= 1') - tdSql.error('select 1 <= \'abc\'') - tdSql.error('select \'abc\' <= 1.0') - tdSql.error('select 1.0 <= \'abc\'') - tdSql.error('select \'abc\' <= true') - tdSql.error('select false <= \'abc\'') + tdSql.error('select "abc" <= "def" from tb;') + tdSql.error('select "abc" <= 1 from tb;') + tdSql.error('select 1 <= "abc" from tb;') + tdSql.error('select "abc" <= 1.0 from tb;') + tdSql.error('select 1.0 <= "abc" from tb;') + tdSql.error('select "abc" <= true from tb;') + tdSql.error('select false <= "abc" from tb;') + tdSql.error('select \'abc\' <= \'def\' from tb;') + tdSql.error('select \'abc\' <= 1 from tb;') + tdSql.error('select 1 <= \'abc\' from tb;') + tdSql.error('select \'abc\' <= 1.0 from tb;') + tdSql.error('select 1.0 <= \'abc\' from tb;') + tdSql.error('select \'abc\' <= true from tb;') + tdSql.error('select false <= \'abc\' from tb;') ##operator: >= tdSql.query('select 1 >= 2 from tb;') @@ -752,20 +752,20 @@ class TDTestCase: tdSql.checkRows(1) tdSql.checkData(0, 0, 1) - tdSql.error('select "abc" >= "def"') - tdSql.error('select "abc" >= 1') - tdSql.error('select 1 >= "abc"') - tdSql.error('select "abc" >= 1.0') - tdSql.error('select 1.0 >= "abc"') - tdSql.error('select "abc" >= true') - tdSql.error('select false >= "abc"') - tdSql.error('select \'abc\' >= \'def\'') - tdSql.error('select \'abc\' >= 1') - tdSql.error('select 1 >= \'abc\'') - tdSql.error('select \'abc\' >= 1.0') - tdSql.error('select 1.0 >= \'abc\'') - tdSql.error('select \'abc\' >= true') - tdSql.error('select false >= \'abc\'') + tdSql.error('select "abc" >= "def" from tb;') + tdSql.error('select "abc" >= 1 from tb;') + tdSql.error('select 1 >= "abc" from tb;') + tdSql.error('select "abc" >= 1.0 from tb;') + tdSql.error('select 1.0 >= "abc" from tb;') + tdSql.error('select "abc" >= true from tb;') + tdSql.error('select false >= "abc" from tb;') + tdSql.error('select \'abc\' >= \'def\' from tb;') + tdSql.error('select \'abc\' >= 1 from tb;') + tdSql.error('select 1 >= \'abc\' from tb;') + tdSql.error('select \'abc\' >= 1.0 from tb;') + tdSql.error('select 1.0 >= \'abc\' from tb;') + tdSql.error('select \'abc\' >= true from tb;') + tdSql.error('select false >= \'abc\' from tb;') ##operator: between and tdSql.query('select 1 between 2 and 4 from tb;') @@ -913,27 +913,27 @@ class TDTestCase: tdSql.checkRows(1) tdSql.checkData(0, 0, 1) - tdSql.error('select "abc" between "def" and "ghi"') - tdSql.error('select "abc" between 1 and 2') - tdSql.error('select "abc" between 1.0 and 2.0') - tdSql.error('select "abc" between true and false') - tdSql.error('select 1 between 1.0 and "cde"') - tdSql.error('select 1.0 between true and "cde"') - tdSql.error('select true between 1 and "cde"') - tdSql.error('select 1 between "abc" and 1.0') - tdSql.error('select 1.0 between "abc" and true') - tdSql.error('select true between "abc" and 1') - - tdSql.error('select \'abc\' between \'def\' and \'ghi\'') - tdSql.error('select \'abc\' between 1 and 2') - tdSql.error('select \'abc\' between 1.0 and 2.0') - tdSql.error('select \'abc\' between true and false') - tdSql.error('select 1 between 1.0 and \'cde\'') - tdSql.error('select 1.0 between true and \'cde\'') - tdSql.error('select true between 1 and \'cde\'') - tdSql.error('select 1 between \'abc\' and 1.0') - tdSql.error('select 1.0 between \'abc\' and true') - tdSql.error('select true between \'abc\' and 1') + tdSql.error('select "abc" between "def" and "ghi" from tb;') + tdSql.error('select "abc" between 1 and 2 from tb;') + tdSql.error('select "abc" between 1.0 and 2.0 from tb;') + tdSql.error('select "abc" between true and false from tb;') + tdSql.error('select 1 between 1.0 and "cde" from tb;') + tdSql.error('select 1.0 between true and "cde" from tb;') + tdSql.error('select true between 1 and "cde" from tb;') + tdSql.error('select 1 between "abc" and 1.0 from tb;') + tdSql.error('select 1.0 between "abc" and true from tb;') + tdSql.error('select true between "abc" and 1 from tb;') + + tdSql.error('select \'abc\' between \'def\' and \'ghi\' from tb;') + tdSql.error('select \'abc\' between 1 and 2 from tb;') + tdSql.error('select \'abc\' between 1.0 and 2.0 from tb;') + tdSql.error('select \'abc\' between true and false from tb;') + tdSql.error('select 1 between 1.0 and \'cde\' from tb;') + tdSql.error('select 1.0 between true and \'cde\' from tb;') + tdSql.error('select true between 1 and \'cde\' from tb;') + tdSql.error('select 1 between \'abc\' and 1.0 from tb;') + tdSql.error('select 1.0 between \'abc\' and true from tb;') + tdSql.error('select true between \'abc\' and 1 from tb;') ##operator: and tdSql.query('select 10 and 10 from tb;') @@ -988,26 +988,26 @@ class TDTestCase: tdSql.checkRows(1) tdSql.checkData(0, 0, 0) - tdSql.error('select "abc" and "def"') - tdSql.error('select "abc" and 1') - tdSql.error('select 1 and "abc"') - tdSql.error('select "abc" and 1.0') - tdSql.error('select 1.0 and abc') - tdSql.error('select "abc" and true') - tdSql.error('select false and "abc"') - tdSql.error('select 1 and "abc" and 1.0 and true and false and 0') - tdSql.error('select 1 and "abc" and 1.0 and "cde" and false and 0') - tdSql.error('select 1 and "abc" and 1.0 and "cde" and false and "fhi"') + tdSql.error('select "abc" and "def" from tb;') + tdSql.error('select "abc" and 1 from tb;') + tdSql.error('select 1 and "abc" from tb;') + tdSql.error('select "abc" and 1.0 from tb;') + tdSql.error('select 1.0 and abc from tb;') + tdSql.error('select "abc" and true from tb;') + tdSql.error('select false and "abc" from tb;') + tdSql.error('select 1 and "abc" and 1.0 and true and false and 0 from tb;') + tdSql.error('select 1 and "abc" and 1.0 and "cde" and false and 0 from tb;') + tdSql.error('select 1 and "abc" and 1.0 and "cde" and false and "fhi" from tb;') - tdSql.error('select \'abc\' and \'def\'') - tdSql.error('select \'abc\' and 1') - tdSql.error('select 1 and \'abc\'') - tdSql.error('select \'abc\' and 1.0') - tdSql.error('select 1.0 and abc') - tdSql.error('select \'abc\' and true') - tdSql.error('select false and \'abc\'') - tdSql.error('select 1 and \'abc\' and 1.0 and true and false and 0') - tdSql.error('select 1 and \'abc\' and 1.0 and \'cde\' and false and "fhi"') + tdSql.error('select \'abc\' and \'def\' from tb;') + tdSql.error('select \'abc\' and 1 from tb;') + tdSql.error('select 1 and \'abc\' from tb;') + tdSql.error('select \'abc\' and 1.0 from tb;') + tdSql.error('select 1.0 and abc from tb;') + tdSql.error('select \'abc\' and true from tb;') + tdSql.error('select false and \'abc\' from tb;') + tdSql.error('select 1 and \'abc\' and 1.0 and true and false and 0 from tb;') + tdSql.error('select 1 and \'abc\' and 1.0 and \'cde\' and false and "fhi" from tb;') ##operator: or @@ -1051,26 +1051,26 @@ class TDTestCase: tdSql.checkRows(1) tdSql.checkData(0, 0, 1) - tdSql.error('select "abc" or "def"') - tdSql.error('select "abc" or 1') - tdSql.error('select 1 or "abc"') - tdSql.error('select "abc" or 1.0') - tdSql.error('select 1.0 or abc') - tdSql.error('select "abc" or true') - tdSql.error('select false or "abc"') - tdSql.error('select 1 or "abc" or 1.0 or true or false or 0') - tdSql.error('select 1 or "abc" or 1.0 or "cde" or false or 0') - tdSql.error('select 1 or "abc" or 1.0 or "cde" or false or "fhi"') - - tdSql.error('select \'abc\' or \'def\'') - tdSql.error('select \'abc\' or 1') - tdSql.error('select 1 or \'abc\'') - tdSql.error('select \'abc\' or 1.0') - tdSql.error('select 1.0 or abc') - tdSql.error('select \'abc\' or true') - tdSql.error('select false or \'abc\'') - tdSql.error('select 1 or \'abc\' or 1.0 or true or false or 0') - tdSql.error('select 1 or \'abc\' or 1.0 or \'cde\' or false or "fhi"') + tdSql.error('select "abc" or "def" from tb;') + tdSql.error('select "abc" or 1 from tb;') + tdSql.error('select 1 or "abc" from tb;') + tdSql.error('select "abc" or 1.0 from tb;') + tdSql.error('select 1.0 or abc from tb;') + tdSql.error('select "abc" or true from tb;') + tdSql.error('select false or "abc" from tb;') + tdSql.error('select 1 or "abc" or 1.0 or true or false or 0 from tb;') + tdSql.error('select 1 or "abc" or 1.0 or "cde" or false or 0 from tb;') + tdSql.error('select 1 or "abc" or 1.0 or "cde" or false or "fhi" from tb;') + + tdSql.error('select \'abc\' or \'def\' from tb;') + tdSql.error('select \'abc\' or 1 from tb;') + tdSql.error('select 1 or \'abc\' from tb;') + tdSql.error('select \'abc\' or 1.0 from tb;') + tdSql.error('select 1.0 or abc from tb;') + tdSql.error('select \'abc\' or true from tb;') + tdSql.error('select false or \'abc\' from tb;') + tdSql.error('select 1 or \'abc\' or 1.0 or true or false or 0 from tb;') + tdSql.error('select 1 or \'abc\' or 1.0 or \'cde\' or false or "fhi" from tb;') ##operator: multiple operations tdSql.query('select 1 and 1 != 2 and 1 < 2 and 2 between 1 and 3 from tb;') -- GitLab