From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 10F216EC40; Wed, 11 Aug 2021 19:03:44 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 10F216EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1628697824; bh=+OVkNa/SYxx8bPfPcUI4/D0elASssgRFuI0pqgpOpBI=; h=To:Cc:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=LPxszPVUs3xHn2xFVauVnoWAmDqJqWAFQ2sT6SnUrghxd2YDcEfUZ/PYQSc3zAPLj X1f8EO+kxs7VNY76b12HTIoCz4y8LP6tYoIRazr+vJ/jqFObklvbrsz681455dR8vT mSweaAxd7H4uiF/TmaM3i0vSg83PSwsbZoQNgSBc= Received: from smtpng2.i.mail.ru (smtpng2.i.mail.ru [94.100.179.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 018E26EC43 for ; Wed, 11 Aug 2021 19:01:46 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 018E26EC43 Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1mDqfq-0006VF-03; Wed, 11 Aug 2021 19:01:46 +0300 To: v.shpilevoy@tarantool.org Cc: tarantool-patches@dev.tarantool.org Date: Wed, 11 Aug 2021 19:01:45 +0300 Message-Id: <3c3652e1b5d8c9f22206bff7038bde035cc6d04b.1628697448.git.imeevma@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD92087353F0EC44DD9ECFD080E047A606F6525B29142351271182A05F53808504037048BC5D73D4E10425A9744B5C122936CF2684A2552240C1DE05419C182B3F8 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE751C3618ECA219898EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637107AA061ADD8C4B78638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D81EDDBB578EF7CADBFB84CEF49EAFC498117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCF1175FABE1C0F9B6A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735209ECD01F8117BC8BEA471835C12D1D977C4224003CC8364762BB6847A3DEAEFB0F43C7A68FF6260569E8FC8737B5C2249EC8D19AE6D49635B68655334FD4449CB9ECD01F8117BC8BEAAAE862A0553A39223F8577A6DFFEA7C289736CE4F78F08343847C11F186F3C59DAA53EE0834AAEE X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C6B668463F4F89F861C45787C86F7B9EDE9EB71D62AD7E9399C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EFA183FDCE24978B01699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34F38194B2C99DC12834DAD3A30EF62FF60D20CD6126B5F97ADB3C313BEB80DA4D42C55CBF883C40291D7E09C32AA3244CE0DE2B56BA6914E1BE2BC196F82815966C24832127668422729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj6qlzQV0oSZNmq+R5ZC9+mQ== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5DA425E275566BA828D044F8E963A5A2BE83D72C36FC87018B9F80AB2734326CD2FB559BB5D741EB96352A0ABBE4FDA4210A04DAD6CC59E33667EA787935ED9F1B X-Mras: Ok Subject: [Tarantool-patches] [PATCH v1 4/7] sql: disallow arithmetic for NUMBER and SCALAR X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Mergen Imeev via Tarantool-patches Reply-To: imeevma@tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This patch disallows arithmetic operations for SCALAR and NUMBER values. It also corrects the description of the error that is generated when an inappropriate value participates in an arithmetic operation. Part of #6221 --- src/box/sql/mem.c | 60 +-- src/box/sql/mem.h | 6 + test/sql-tap/colname.test.lua | 4 +- test/sql-tap/e_select1.test.lua | 6 +- .../gh-5335-wrong-int-to-double-cast.test.lua | 40 -- ...-5756-implicit-cast-in-arithmetic.test.lua | 32 +- test/sql-tap/metatypes.test.lua | 19 +- test/sql-tap/minmax2.test.lua | 2 +- test/sql-tap/numcast.test.lua | 58 +-- test/sql-tap/select7.test.lua | 8 +- test/sql-tap/sort.test.lua | 14 +- test/sql-tap/sql-errors.test.lua | 8 +- test/sql-tap/tkt-91e2e8ba6f.test.lua | 96 ---- test/sql-tap/tkt-a8a0d2996a.test.lua | 18 +- test/sql-tap/uuid.test.lua | 10 +- test/sql-tap/view.test.lua | 4 +- test/sql/boolean.result | 434 +++++++++--------- test/sql/boolean.test.sql | 4 +- test/sql/prepared.result | 2 +- test/sql/prepared.test.lua | 2 +- test/sql/types.result | 3 +- 21 files changed, 323 insertions(+), 507 deletions(-) delete mode 100755 test/sql-tap/gh-5335-wrong-int-to-double-cast.test.lua delete mode 100755 test/sql-tap/tkt-91e2e8ba6f.test.lua diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c index 8468c0030..e2c85e2ea 100644 --- a/src/box/sql/mem.c +++ b/src/box/sql/mem.c @@ -1590,6 +1590,22 @@ mem_concat(struct Mem *a, struct Mem *b, struct Mem *result) return 0; } +static inline int +check_types_numeric_arithmetic(const struct Mem *a, const struct Mem *b) +{ + if (!mem_is_num(a) || mem_is_metatype(a)) { + diag_set(ClientError, ER_SQL_TYPE_MISMATCH, mem_str(a), + "integer, unsigned or double"); + return -1; + } + if (!mem_is_num(b) || mem_is_metatype(b)) { + diag_set(ClientError, ER_SQL_TYPE_MISMATCH, mem_str(b), + "integer, unsigned or double"); + return -1; + } + return 0; +} + int mem_add(const struct Mem *left, const struct Mem *right, struct Mem *result) { @@ -1597,16 +1613,8 @@ mem_add(const struct Mem *left, const struct Mem *right, struct Mem *result) mem_set_null(result); return 0; } - if (!mem_is_num(right)) { - diag_set(ClientError, ER_SQL_TYPE_MISMATCH, mem_str(right), - "number"); + if (check_types_numeric_arithmetic(right, left) != 0) return -1; - } - if (!mem_is_num(left)) { - diag_set(ClientError, ER_SQL_TYPE_MISMATCH, mem_str(left), - "number"); - return -1; - } if (((left->type | right->type) & MEM_TYPE_DOUBLE) != 0) { double a; double b; @@ -1633,16 +1641,8 @@ mem_sub(const struct Mem *left, const struct Mem *right, struct Mem *result) mem_set_null(result); return 0; } - if (!mem_is_num(right)) { - diag_set(ClientError, ER_SQL_TYPE_MISMATCH, mem_str(right), - "number"); - return -1; - } - if (!mem_is_num(left)) { - diag_set(ClientError, ER_SQL_TYPE_MISMATCH, mem_str(left), - "number"); + if (check_types_numeric_arithmetic(right, left) != 0) return -1; - } if (((left->type | right->type) & MEM_TYPE_DOUBLE) != 0) { double a; double b; @@ -1669,16 +1669,8 @@ mem_mul(const struct Mem *left, const struct Mem *right, struct Mem *result) mem_set_null(result); return 0; } - if (!mem_is_num(right)) { - diag_set(ClientError, ER_SQL_TYPE_MISMATCH, mem_str(right), - "number"); + if (check_types_numeric_arithmetic(right, left) != 0) return -1; - } - if (!mem_is_num(left)) { - diag_set(ClientError, ER_SQL_TYPE_MISMATCH, mem_str(left), - "number"); - return -1; - } if (((left->type | right->type) & MEM_TYPE_DOUBLE) != 0) { double a; double b; @@ -1705,16 +1697,8 @@ mem_div(const struct Mem *left, const struct Mem *right, struct Mem *result) mem_set_null(result); return 0; } - if (!mem_is_num(right)) { - diag_set(ClientError, ER_SQL_TYPE_MISMATCH, mem_str(right), - "number"); + if (check_types_numeric_arithmetic(right, left) != 0) return -1; - } - if (!mem_is_num(left)) { - diag_set(ClientError, ER_SQL_TYPE_MISMATCH, mem_str(left), - "number"); - return -1; - } if (((left->type | right->type) & MEM_TYPE_DOUBLE) != 0) { double a; double b; @@ -1750,12 +1734,12 @@ mem_rem(const struct Mem *left, const struct Mem *right, struct Mem *result) mem_set_null(result); return 0; } - if (!mem_is_int(right)) { + if (!mem_is_int(right) || mem_is_metatype(right)) { diag_set(ClientError, ER_SQL_TYPE_MISMATCH, mem_str(right), "integer"); return -1; } - if (!mem_is_int(left)) { + if (!mem_is_int(left) || mem_is_metatype(left)) { diag_set(ClientError, ER_SQL_TYPE_MISMATCH, mem_str(left), "integer"); return -1; diff --git a/src/box/sql/mem.h b/src/box/sql/mem.h index a5c9015cd..5f004646e 100644 --- a/src/box/sql/mem.h +++ b/src/box/sql/mem.h @@ -141,6 +141,12 @@ mem_is_num(const struct Mem *mem) return (type & (MEM_TYPE_UINT | MEM_TYPE_INT | MEM_TYPE_DOUBLE)) != 0; } +static inline bool +mem_is_metatype(const struct Mem *mem) +{ + return (mem->flags & (MEM_Number | MEM_Scalar)) != 0; +} + static inline bool mem_is_double(const struct Mem *mem) { diff --git a/test/sql-tap/colname.test.lua b/test/sql-tap/colname.test.lua index 9ea0b2d4a..ff7585c7a 100755 --- a/test/sql-tap/colname.test.lua +++ b/test/sql-tap/colname.test.lua @@ -673,7 +673,7 @@ test:do_execsql2_test( test:do_execsql2_test( "colname-12.5", [[ - CREATE TABLE j (s1 SCALAR PRIMARY KEY); + CREATE TABLE j (s1 INTEGER PRIMARY KEY); INSERT INTO j VALUES(1); ]], {}) @@ -750,7 +750,7 @@ test:do_execsql2_test( test:do_execsql2_test( "colname-12.14", [[ - CREATE TABLE j_1 (column_1 SCALAR PRIMARY KEY, column_2 SCALAR); + CREATE TABLE j_1 (column_1 INTEGER PRIMARY KEY, column_2 SCALAR); INSERT INTO j_1 VALUES(1, 1); ]], {}) diff --git a/test/sql-tap/e_select1.test.lua b/test/sql-tap/e_select1.test.lua index 8293965b8..27bd44ac4 100755 --- a/test/sql-tap/e_select1.test.lua +++ b/test/sql-tap/e_select1.test.lua @@ -756,9 +756,9 @@ test:drop_all_tables() test:do_execsql_test( "e_select-4.0", [[ - CREATE TABLE z1(id INT primary key, a NUMBER, b NUMBER, c TEXT); - CREATE TABLE z2(id INT primary key, d NUMBER, e NUMBER); - CREATE TABLE z3(id INT primary key, a NUMBER, b NUMBER); + CREATE TABLE z1(id INT primary key, a DOUBLE, b DOUBLE, c TEXT); + CREATE TABLE z2(id INT primary key, d DOUBLE, e DOUBLE); + CREATE TABLE z3(id INT primary key, a DOUBLE, b DOUBLE); INSERT INTO z1 VALUES(1, 51.65, -59.58, 'belfries'); INSERT INTO z1 VALUES(2, -5, NULL, '75'); diff --git a/test/sql-tap/gh-5335-wrong-int-to-double-cast.test.lua b/test/sql-tap/gh-5335-wrong-int-to-double-cast.test.lua deleted file mode 100755 index 76daa45e9..000000000 --- a/test/sql-tap/gh-5335-wrong-int-to-double-cast.test.lua +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env tarantool -local test = require("sqltester") -test:plan(2) - -test:execsql([[ - CREATE TABLE t1 (i NUMBER PRIMARY KEY, n NUMBER); - CREATE TABLE t2 (i NUMBER PRIMARY KEY, n NUMBER); - -- This trigger is only needed to reproduce the error. - CREATE TRIGGER r AFTER INSERT ON t1 FOR EACH ROW BEGIN UPDATE t1 SET n = new.n; END; - INSERT INTO t1 VALUES (1, 1); - INSERT INTO t2 VALUES (1, 1); -]]) - --- --- Make sure that there are no unnecesary INTEGER to DOUBLE implicit cast in --- field of type NUMBER. --- -test:do_execsql_test( - "gh-5335-1", - [[ - SELECT i / 2, n / 2 FROM t1; - ]], { - 0, 0 - }) - -test:do_execsql_test( - "gh-5335-2", - [[ - SELECT i / 2, n / 2 FROM t2 GROUP BY n; - ]], { - 0, 0 - }) - -test:execsql([[ - DROP TRIGGER r; - DROP TABLE t1; - DROP TABLE t2; -]]) - -test:finish_test() diff --git a/test/sql-tap/gh-5756-implicit-cast-in-arithmetic.test.lua b/test/sql-tap/gh-5756-implicit-cast-in-arithmetic.test.lua index 9ce595fe0..3e4de6860 100755 --- a/test/sql-tap/gh-5756-implicit-cast-in-arithmetic.test.lua +++ b/test/sql-tap/gh-5756-implicit-cast-in-arithmetic.test.lua @@ -35,7 +35,7 @@ test:do_catchsql_test( [[ SELECT 9 + '2'; ]], { - 1, "Type mismatch: can not convert string('2') to number" + 1, "Type mismatch: can not convert string('2') to integer, unsigned or double" }) test:do_catchsql_test( @@ -43,7 +43,7 @@ test:do_catchsql_test( [[ SELECT 9 + x'32'; ]], { - 1, "Type mismatch: can not convert varbinary(x'32') to number" + 1, "Type mismatch: can not convert varbinary(x'32') to integer, unsigned or double" }) test:do_catchsql_test( @@ -51,7 +51,7 @@ test:do_catchsql_test( [[ SELECT 9 + true; ]], { - 1, "Type mismatch: can not convert boolean(TRUE) to number" + 1, "Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double" }) test:do_catchsql_test( @@ -60,7 +60,7 @@ test:do_catchsql_test( SELECT 9 + CAST('11111111-1111-1111-1111-111111111111' AS UUID); ]], { 1, "Type mismatch: can not convert ".. - "uuid('11111111-1111-1111-1111-111111111111') to number" + "uuid('11111111-1111-1111-1111-111111111111') to integer, unsigned or double" }) test:do_execsql_test( @@ -92,7 +92,7 @@ test:do_catchsql_test( [[ SELECT 9 - '2'; ]], { - 1, "Type mismatch: can not convert string('2') to number" + 1, "Type mismatch: can not convert string('2') to integer, unsigned or double" }) test:do_catchsql_test( @@ -100,7 +100,7 @@ test:do_catchsql_test( [[ SELECT 9 - x'32'; ]], { - 1, "Type mismatch: can not convert varbinary(x'32') to number" + 1, "Type mismatch: can not convert varbinary(x'32') to integer, unsigned or double" }) test:do_catchsql_test( @@ -108,7 +108,7 @@ test:do_catchsql_test( [[ SELECT 9 - true; ]], { - 1, "Type mismatch: can not convert boolean(TRUE) to number" + 1, "Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double" }) test:do_catchsql_test( @@ -117,7 +117,7 @@ test:do_catchsql_test( SELECT 9 - CAST('11111111-1111-1111-1111-111111111111' AS UUID); ]], { 1, "Type mismatch: can not convert ".. - "uuid('11111111-1111-1111-1111-111111111111') to number" + "uuid('11111111-1111-1111-1111-111111111111') to integer, unsigned or double" }) test:do_execsql_test( @@ -149,7 +149,7 @@ test:do_catchsql_test( [[ SELECT 9 * '2'; ]], { - 1, "Type mismatch: can not convert string('2') to number" + 1, "Type mismatch: can not convert string('2') to integer, unsigned or double" }) test:do_catchsql_test( @@ -157,7 +157,7 @@ test:do_catchsql_test( [[ SELECT 9 * x'32'; ]], { - 1, "Type mismatch: can not convert varbinary(x'32') to number" + 1, "Type mismatch: can not convert varbinary(x'32') to integer, unsigned or double" }) test:do_catchsql_test( @@ -165,7 +165,7 @@ test:do_catchsql_test( [[ SELECT 9 * true; ]], { - 1, "Type mismatch: can not convert boolean(TRUE) to number" + 1, "Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double" }) test:do_catchsql_test( @@ -174,7 +174,7 @@ test:do_catchsql_test( SELECT 9 * CAST('11111111-1111-1111-1111-111111111111' AS UUID); ]], { 1, "Type mismatch: can not convert ".. - "uuid('11111111-1111-1111-1111-111111111111') to number" + "uuid('11111111-1111-1111-1111-111111111111') to integer, unsigned or double" }) test:do_execsql_test( @@ -206,7 +206,7 @@ test:do_catchsql_test( [[ SELECT 9 / '2'; ]], { - 1, "Type mismatch: can not convert string('2') to number" + 1, "Type mismatch: can not convert string('2') to integer, unsigned or double" }) test:do_catchsql_test( @@ -214,7 +214,7 @@ test:do_catchsql_test( [[ SELECT 9 / x'32'; ]], { - 1, "Type mismatch: can not convert varbinary(x'32') to number" + 1, "Type mismatch: can not convert varbinary(x'32') to integer, unsigned or double" }) test:do_catchsql_test( @@ -222,7 +222,7 @@ test:do_catchsql_test( [[ SELECT 9 / true; ]], { - 1, "Type mismatch: can not convert boolean(TRUE) to number" + 1, "Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double" }) test:do_catchsql_test( @@ -231,7 +231,7 @@ test:do_catchsql_test( SELECT 9 / CAST('11111111-1111-1111-1111-111111111111' AS UUID); ]], { 1, "Type mismatch: can not convert ".. - "uuid('11111111-1111-1111-1111-111111111111') to number" + "uuid('11111111-1111-1111-1111-111111111111') to integer, unsigned or double" }) test:do_execsql_test( diff --git a/test/sql-tap/metatypes.test.lua b/test/sql-tap/metatypes.test.lua index 2748ab781..c0b2a4d03 100755 --- a/test/sql-tap/metatypes.test.lua +++ b/test/sql-tap/metatypes.test.lua @@ -1,6 +1,6 @@ #!/usr/bin/env tarantool local test = require("sqltester") -test:plan(8) +test:plan(10) -- Check that SCALAR and NUMBER meta-types works as intended. box.execute([[CREATE TABLE t (i INT PRIMARY KEY, s SCALAR, n NUMBER);]]) @@ -90,6 +90,23 @@ test:do_catchsql_test( 1, "Type mismatch: can not convert number(11) to integer" }) +-- Check that arithmetic operations are prohibited for NUMBER and SCALAR values. +test:do_catchsql_test( + "metatypes-3.1", + [[ + SELECT 1 + CAST(1 AS NUMBER); + ]], { + 1, "Type mismatch: can not convert number(1) to integer, unsigned or double" + }) + +test:do_catchsql_test( + "metatypes-3.2", + [[ + SELECT CAST(1 AS SCALAR) * 1; + ]], { + 1, "Type mismatch: can not convert scalar(1) to integer, unsigned or double" + }) + box.execute([[DROP TABLE t;]]) test:finish_test() diff --git a/test/sql-tap/minmax2.test.lua b/test/sql-tap/minmax2.test.lua index 31212bc18..42dbafea8 100755 --- a/test/sql-tap/minmax2.test.lua +++ b/test/sql-tap/minmax2.test.lua @@ -278,7 +278,7 @@ test:do_execsql_test( test:do_execsql_test( "minmax2-4.1", [[ - SELECT coalesce(min(x+0),-1), coalesce(max(x+0),-1) FROM + SELECT coalesce(min(x),-1), coalesce(max(x),-1) FROM (SELECT x, y FROM t1 UNION SELECT NULL as "x", NULL as "y") ]], { -- diff --git a/test/sql-tap/numcast.test.lua b/test/sql-tap/numcast.test.lua index b172ca625..763708d76 100755 --- a/test/sql-tap/numcast.test.lua +++ b/test/sql-tap/numcast.test.lua @@ -1,6 +1,6 @@ #!/usr/bin/env tarantool local test = require("sqltester") -test:plan(31) +test:plan(26) --!./tcltestrunner.lua -- 2013 March 20 @@ -144,62 +144,6 @@ test:do_catchsql_test( 1, "Type mismatch: can not convert double(2.1) to integer" }) --- --- gh-4233: Make sure that NUMBER can contain UNSIGNED, INTEGER --- and DOUBLE and is not automatically converted to DOUBLE. --- -test:do_execsql_test( - "numcast-3.3", - [[ - SELECT CAST('11111111111111111111' AS NUMBER); - ]], { - 11111111111111111111ULL - }) - -test:do_execsql_test( - "numcast-3.4", - [[ - SELECT CAST('101' AS NUMBER) / 10, CAST('101.' AS NUMBER) / 10; - ]], { - 10, 10.1 - }) - -test:do_execsql_test( - "numcast-3.5", - [[ - SELECT CAST('101 ' AS NUMBER) / 10, CAST(' 101' AS NUMBER) / 10; - ]], { - 10, 10 - }) - -test:do_execsql_test( - "numcast-3.6", - [[ - CREATE TABLE t1 (id INT PRIMARY KEY, n NUMBER); - INSERT INTO t1 VALUES (1, 9223372036854775807); - INSERT INTO t1 VALUES (2, -9223372036854775807); - INSERT INTO t1 VALUES (3, 9007199254740992.0); - SELECT n, n/100 FROM t1; - ]], { - 9223372036854775807ULL, 92233720368547758ULL, - -9223372036854775807LL, -92233720368547758LL, - 9007199254740992, 90071992547409.92 - }) - -test:do_execsql_test( - "numcast-3.7", - [[ - CREATE TABLE t2(a NUMBER primary key); - INSERT INTO t2 VALUES(-56); - INSERT INTO t2 VALUES(44.0); - INSERT INTO t2 VALUES(46); - INSERT INTO t2 VALUES(56.0); - SELECT (a + 25) / 50 FROM t2; - ]], { - 0,1.38,1,1.62 -}) - - test:do_execsql_test( "numcast-3.8", [[ diff --git a/test/sql-tap/select7.test.lua b/test/sql-tap/select7.test.lua index 815f9110b..b1cc32eee 100755 --- a/test/sql-tap/select7.test.lua +++ b/test/sql-tap/select7.test.lua @@ -187,7 +187,7 @@ test:do_catchsql_test( test:do_execsql_test( "select7-7.1", [[ - CREATE TABLE t3(a NUMBER primary key); + CREATE TABLE t3(a DOUBLE primary key); INSERT INTO t3 VALUES(44.0); INSERT INTO t3 VALUES(56.0); ]], { @@ -210,7 +210,7 @@ test:do_execsql_test( test:do_execsql_test( "select7-7.3", [[ - CREATE TABLE t4(a NUMBER primary key); + CREATE TABLE t4(a DOUBLE primary key); INSERT INTO t4 VALUES( 2.0 ); INSERT INTO t4 VALUES( 3.0 ); ]], { @@ -235,7 +235,7 @@ test:do_execsql_test( SELECT a=0, typeof(a) FROM t4 ]], { -- - false, "number", false, "number" + false, "double", false, "double" -- }) @@ -245,7 +245,7 @@ test:do_execsql_test( SELECT a=0, typeof(a) FROM t4 GROUP BY a ]], { -- - false, "number", false, "number" + false, "double", false, "double" -- }) diff --git a/test/sql-tap/sort.test.lua b/test/sql-tap/sort.test.lua index 0a1c2aabf..68a0ecbd2 100755 --- a/test/sql-tap/sort.test.lua +++ b/test/sql-tap/sort.test.lua @@ -30,7 +30,7 @@ test:do_test( v varchar(10), log int, roman varchar(10), - flt NUMBER + flt DOUBLE ); INSERT INTO t1 VALUES(1,'one',0,'I',3.141592653); INSERT INTO t1 VALUES(2,'two',1,'II',2.15); @@ -242,7 +242,7 @@ test:do_execsql_test( SELECT v FROM t1 ORDER BY v; ]], { -- - "x-123.0", "x-2.15", "x-2b", "x-3.141592653", "x-4221.0", "x0.0013442", "x1.6", "x11" + "x-123.0", "x-2.15", "x-2b", "x-3.141592653", "x-4221.0", "x0.0013442", "x1.6", "x11.0" -- }) @@ -252,7 +252,7 @@ test:do_execsql_test( SELECT v FROM t1 ORDER BY substr(v,2,999); ]], { -- - "x-123.0", "x-2.15", "x-2b", "x-3.141592653", "x-4221.0", "x0.0013442", "x1.6", "x11" + "x-123.0", "x-2.15", "x-2b", "x-3.141592653", "x-4221.0", "x0.0013442", "x1.6", "x11.0" -- }) @@ -262,7 +262,7 @@ test:do_execsql_test( SELECT v FROM t1 ORDER BY substr(v,2,999) DESC; ]], { -- - "x11", "x1.6", "x0.0013442", "x-4221.0", "x-3.141592653", "x-2b", "x-2.15", "x-123.0" + "x11.0", "x1.6", "x0.0013442", "x-4221.0", "x-3.141592653", "x-2b", "x-2.15", "x-123.0" -- }) @@ -380,7 +380,7 @@ test:do_execsql_test( SELECT v FROM t1 ORDER BY 1; ]], { -- - "x-123.0", "x-2.15", "x-2b", "x-3.141592653", "x-4.0e9", "x-4221.0", "x0.0013442", "x01234567890123456789", "x1.6", "x11", "x2.7", "x5.0e10" + "x-123.0", "x-2.15", "x-2b", "x-3.141592653", "x-4.0e9", "x-4221.0", "x0.0013442", "x01234567890123456789", "x1.6", "x11.0", "x2.7", "x5.0e10" -- }) @@ -390,7 +390,7 @@ test:do_execsql_test( SELECT v FROM t1 ORDER BY 1 DESC; ]], { -- - "x5.0e10", "x2.7", "x11", "x1.6", "x01234567890123456789", "x0.0013442", "x-4221.0", "x-4.0e9", "x-3.141592653", "x-2b", "x-2.15", "x-123.0" + "x5.0e10", "x2.7", "x11.0", "x1.6", "x01234567890123456789", "x0.0013442", "x-4221.0", "x-4.0e9", "x-3.141592653", "x-2b", "x-2.15", "x-123.0" -- }) @@ -400,7 +400,7 @@ test:do_execsql_test( SELECT substr(v,2,99) FROM t1 ORDER BY 1; ]], { -- - "-123.0","-2.15","-2b","-3.141592653","-4.0e9","-4221.0","0.0013442","01234567890123456789","1.6","11","2.7","5.0e10" + "-123.0","-2.15","-2b","-3.141592653","-4.0e9","-4221.0","0.0013442","01234567890123456789","1.6","11.0","2.7","5.0e10" -- }) diff --git a/test/sql-tap/sql-errors.test.lua b/test/sql-tap/sql-errors.test.lua index 409c97257..daf0ee643 100755 --- a/test/sql-tap/sql-errors.test.lua +++ b/test/sql-tap/sql-errors.test.lua @@ -696,7 +696,7 @@ test:do_catchsql_test( SELECT X'ff' + 1; ]], { -- - 1, "Type mismatch: can not convert varbinary(x'FF') to number" + 1, "Type mismatch: can not convert varbinary(x'FF') to integer, unsigned or double" -- }) @@ -706,7 +706,7 @@ test:do_catchsql_test( SELECT X'ff' - 1; ]], { -- - 1, "Type mismatch: can not convert varbinary(x'FF') to number" + 1, "Type mismatch: can not convert varbinary(x'FF') to integer, unsigned or double" -- }) @@ -716,7 +716,7 @@ test:do_catchsql_test( SELECT X'ff' * 1; ]], { -- - 1, "Type mismatch: can not convert varbinary(x'FF') to number" + 1, "Type mismatch: can not convert varbinary(x'FF') to integer, unsigned or double" -- }) @@ -726,7 +726,7 @@ test:do_catchsql_test( SELECT X'ff' / 1; ]], { -- - 1, "Type mismatch: can not convert varbinary(x'FF') to number" + 1, "Type mismatch: can not convert varbinary(x'FF') to integer, unsigned or double" -- }) diff --git a/test/sql-tap/tkt-91e2e8ba6f.test.lua b/test/sql-tap/tkt-91e2e8ba6f.test.lua deleted file mode 100755 index f575e213f..000000000 --- a/test/sql-tap/tkt-91e2e8ba6f.test.lua +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env tarantool -local test = require("sqltester") -test:plan(7) - ---!./tcltestrunner.lua --- 2011 June 23 --- --- May you do good and not evil. --- May you find forgiveness for yourself and forgive others. --- May you share freely, never taking more than you give. --- -------------------------------------------------------------------------- --- --- This file contains tests for sql. Specifically, it tests that sql --- does not crash and an error is returned if localhost() fails. This --- is the problem reported by ticket 91e2e8ba6f. --- --- ["set","testdir",[["file","dirname",["argv0"]]]] --- ["source",[["testdir"],"\/tester.tcl"]] -test:do_execsql_test( - 1.1, - [[ - CREATE TABLE t1(x INTEGER PRIMARY KEY, y NUMBER); - INSERT INTO t1 VALUES(11, 11); - ]], { - -- <1.1> - - -- - }) - -test:do_execsql_test( - 1.2, - [[ - SELECT x/10, y/10 FROM t1; - ]], { - -- <1.2> - 1, 1 - -- - }) - -test:do_execsql_test( - 1.3, - [[ - SELECT x/10, y/10 FROM (SELECT * FROM t1); - ]], { - -- <1.3> - 1, 1 - -- - }) - -test:do_execsql_test( - 1.4, - [[ - SELECT x/10, y/10 FROM (SELECT * FROM t1 LIMIT 5 OFFSET 0); - ]], { - -- <1.4> - 1, 1 - -- - }) - -test:do_execsql_test( - 1.5, - [[ - SELECT x/10, y/10 FROM (SELECT * FROM t1 LIMIT 5 OFFSET 0) LIMIT 5 OFFSET 0; - ]], { - -- <1.5> - 1, 1 - -- - }) - -test:do_execsql_test( - 1.6, - [[ - SELECT a.x/10, a.y/10 FROM - (SELECT * FROM t1 LIMIT 5 OFFSET 0) AS a, t1 AS b WHERE a.x = b.x - LIMIT 5 OFFSET 0; - ]], { - -- <1.6> - 1, 1 - -- - }) - --- MUST_WORK_TEST -test:do_execsql_test( - 1.7, - [[ - CREATE VIEW v1 AS SELECT * FROM t1 LIMIT 5; - SELECT a.x/10, a.y/10 FROM v1 AS a, t1 AS b WHERE a.x = b.x LIMIT 5 OFFSET 0; - ]], { - -- <1.7> - 1, 1 - -- - }) - -test:finish_test() - diff --git a/test/sql-tap/tkt-a8a0d2996a.test.lua b/test/sql-tap/tkt-a8a0d2996a.test.lua index e97ff8c60..72f57ec65 100755 --- a/test/sql-tap/tkt-a8a0d2996a.test.lua +++ b/test/sql-tap/tkt-a8a0d2996a.test.lua @@ -27,7 +27,7 @@ test:do_catchsql_test( SELECT typeof(x), typeof(y) FROM t WHERE 1=x+0 AND y=='1'; ]], { -- <1.0> - 1, "Type mismatch: can not convert string('1') to number" + 1, "Type mismatch: can not convert string('1') to integer, unsigned or double" -- }) @@ -37,7 +37,7 @@ test:do_catchsql_test( SELECT typeof(x), typeof(y) FROM t WHERE 1=x-0 AND y=='1'; ]], { -- <1.1> - 1, "Type mismatch: can not convert string('1') to number" + 1, "Type mismatch: can not convert string('1') to integer, unsigned or double" -- }) @@ -47,7 +47,7 @@ test:do_catchsql_test( SELECT typeof(x), typeof(y) FROM t WHERE 1=x*1 AND y=='1'; ]], { -- <1.2> - 1, "Type mismatch: can not convert string('1') to number" + 1, "Type mismatch: can not convert string('1') to integer, unsigned or double" -- }) @@ -57,7 +57,7 @@ test:do_catchsql_test( SELECT typeof(x), typeof(y) FROM t WHERE 1=x/1 AND y=='1'; ]], { -- <1.3> - 1, "Type mismatch: can not convert string('1') to number" + 1, "Type mismatch: can not convert string('1') to integer, unsigned or double" -- }) @@ -78,7 +78,7 @@ test:do_catchsql_test( SELECT typeof(x), typeof(y) FROM t WHERE 1=x+0 AND y=='1'; ]], { -- <3.0> - 1, "Type mismatch: can not convert string('1.0') to number" + 1, "Type mismatch: can not convert string('1.0') to integer, unsigned or double" -- }) @@ -88,7 +88,7 @@ test:do_catchsql_test( SELECT typeof(x), typeof(y) FROM t WHERE 1=x-0 AND y=='1'; ]], { -- <3.1> - 1, "Type mismatch: can not convert string('1.0') to number" + 1, "Type mismatch: can not convert string('1.0') to integer, unsigned or double" -- }) @@ -98,7 +98,7 @@ test:do_catchsql_test( SELECT typeof(x), typeof(y) FROM t WHERE 1=x*1 AND y=='1'; ]], { -- <3.2> - 1, "Type mismatch: can not convert string('1.0') to number" + 1, "Type mismatch: can not convert string('1.0') to integer, unsigned or double" -- }) @@ -108,7 +108,7 @@ test:do_catchsql_test( SELECT typeof(x), typeof(y) FROM t WHERE 1=x/1 AND y=='1'; ]], { -- <3.3> - 1, "Type mismatch: can not convert string('1.0') to number" + 1, "Type mismatch: can not convert string('1.0') to integer, unsigned or double" -- }) @@ -138,7 +138,7 @@ test:do_catchsql_test( SELECT '1.23e64'/'1.0000e+62'; ]], { -- <4.1> - 1, "Type mismatch: can not convert string('1.0000e+62') to number" + 1, "Type mismatch: can not convert string('1.0000e+62') to integer, unsigned or double" -- }) diff --git a/test/sql-tap/uuid.test.lua b/test/sql-tap/uuid.test.lua index 32203e9fb..57e638046 100755 --- a/test/sql-tap/uuid.test.lua +++ b/test/sql-tap/uuid.test.lua @@ -957,7 +957,7 @@ test:do_catchsql_test( [[ SELECT -u FROM t2; ]], { - 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to number" + 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to integer, unsigned or double" }) test:do_catchsql_test( @@ -965,7 +965,7 @@ test:do_catchsql_test( [[ SELECT u + 1 FROM t2; ]], { - 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to number" + 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to integer, unsigned or double" }) test:do_catchsql_test( @@ -973,7 +973,7 @@ test:do_catchsql_test( [[ SELECT u - 1 FROM t2; ]], { - 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to number" + 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to integer, unsigned or double" }) test:do_catchsql_test( @@ -981,7 +981,7 @@ test:do_catchsql_test( [[ SELECT u * 1 FROM t2; ]], { - 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to number" + 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to integer, unsigned or double" }) test:do_catchsql_test( @@ -989,7 +989,7 @@ test:do_catchsql_test( [[ SELECT u / 1 FROM t2; ]], { - 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to number" + 1, "Type mismatch: can not convert uuid('11111111-1111-1111-1111-111111111111') to integer, unsigned or double" }) test:do_catchsql_test( diff --git a/test/sql-tap/view.test.lua b/test/sql-tap/view.test.lua index 1b60f485b..bea1f7db2 100755 --- a/test/sql-tap/view.test.lua +++ b/test/sql-tap/view.test.lua @@ -623,7 +623,7 @@ test:do_execsql_test( test:do_execsql_test( "view-8.6", [[ - SELECT mx+10, pqr FROM v6, v8 WHERE xyz=2; + SELECT CAST(mx AS INTEGER) + 10, pqr FROM v6, v8 WHERE xyz = 2; ]], { -- 13, 7 @@ -633,7 +633,7 @@ test:do_execsql_test( test:do_execsql_test( "view-8.7", [[ - SELECT mx+10, pqr FROM v6, v8 WHERE xyz>2; + SELECT CAST(mx AS INTEGER) + 10, pqr FROM v6, v8 WHERE xyz > 2; ]], { -- 13, 13, 13, 19, 13, 27 diff --git a/test/sql/boolean.result b/test/sql/boolean.result index b325ea458..a8400ee49 100644 --- a/test/sql/boolean.result +++ b/test/sql/boolean.result @@ -1125,98 +1125,98 @@ SELECT a, a1, a OR a1 FROM t, t6; SELECT -true; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT -false; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT -a FROM t; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT true + true; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT true + false; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT false + true; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT false + false; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT true - true; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT true - false; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT false - true; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT false - false; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT true * true; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT true * false; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT false * true; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT false * false; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT true / true; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT true / false; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT false / true; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT false / false; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT true % true; | --- @@ -1242,42 +1242,42 @@ SELECT false % false; SELECT a, true + a FROM t; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a, false + a FROM t; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a, true - a FROM t; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a, false - a FROM t; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a, true * a FROM t; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a, false * a FROM t; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a, true / a FROM t; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a, false / a FROM t; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a, true % a FROM t; | --- @@ -1292,42 +1292,42 @@ SELECT a, false % a FROM t; SELECT a, a + true FROM t; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a, a + false FROM t; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a, a - true FROM t; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a, a - false FROM t; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a, a * true FROM t; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a, a * false FROM t; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a, a / true FROM t; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a, a / false FROM t; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a, a % true FROM t; | --- @@ -1343,22 +1343,22 @@ SELECT a, a % false FROM t; SELECT a, a1, a + a1 FROM t, t6; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a, a1, a - a1 FROM t, t6; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a, a1, a * a1 FROM t, t6; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a, a1, a / a1 FROM t, t6; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a, a1, a % a1 FROM t, t6; | --- @@ -2646,42 +2646,42 @@ SELECT a2, b, b OR a2 FROM t6, t7; SELECT true + 2; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT false + 2; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT true - 2; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT false - 2; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT true * 2; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT false * 2; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT true / 2; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT false / 2; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT true % 2; | --- @@ -2696,42 +2696,42 @@ SELECT false % 2; SELECT 2 + true; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT 2 + false; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT 2 - true; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT 2 - false; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT 2 * true; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT 2 * false; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT 2 / true; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT 2 / false; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT 2 % true; | --- @@ -2747,22 +2747,22 @@ SELECT 2 % false; SELECT a1, a1 + 2 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, a1 - 2 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, a1 * 2 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, a1 / 2 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, a1 % 2 FROM t6 | --- @@ -2772,22 +2772,22 @@ SELECT a1, a1 % 2 FROM t6 SELECT a1, 2 + a1 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, 2 - a1 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, 2 * a1 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, 2 / a1 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, 2 % a1 FROM t6 | --- @@ -2797,22 +2797,22 @@ SELECT a1, 2 % a1 FROM t6 SELECT a2, a2 + 2 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, a2 - 2 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, a2 * 2 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, a2 / 2 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, a2 % 2 FROM t6 | --- @@ -2822,22 +2822,22 @@ SELECT a2, a2 % 2 FROM t6 SELECT a2, 2 + a2 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, 2 - a2 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, 2 * a2 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, 2 / a2 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, 2 % a2 FROM t6 | --- @@ -2848,42 +2848,42 @@ SELECT a2, 2 % a2 FROM t6 SELECT b, true + b FROM t7; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT b, false + b FROM t7; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT b, true - b FROM t7; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT b, false - b FROM t7; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT b, true * b FROM t7; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT b, false * b FROM t7; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT b, true / b FROM t7; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT b, false / b FROM t7; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT b, true % b FROM t7; | --- @@ -2898,42 +2898,42 @@ SELECT b, false % b FROM t7; SELECT b, b + true FROM t7; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT b, b + false FROM t7; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT b, b - true FROM t7; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT b, b - false FROM t7; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT b, b * true FROM t7; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT b, b * false FROM t7; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT b, b / true FROM t7; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT b, b / false FROM t7; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT b, b % true FROM t7; | --- @@ -2949,22 +2949,22 @@ SELECT b, b % false FROM t7; SELECT a1, b, a1 + b FROM t6, t7; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, b, a1 - b FROM t6, t7; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, b, a1 * b FROM t6, t7; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, b, a1 / b FROM t6, t7; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, b, a1 % b FROM t6, t7; | --- @@ -2974,22 +2974,22 @@ SELECT a1, b, a1 % b FROM t6, t7; SELECT a1, b, b + a1 FROM t6, t7; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, b, b - a1 FROM t6, t7; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, b, b * a1 FROM t6, t7; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, b, b / a1 FROM t6, t7; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, b, b % a1 FROM t6, t7; | --- @@ -2999,22 +2999,22 @@ SELECT a1, b, b % a1 FROM t6, t7; SELECT a2, b, a2 + b FROM t6, t7; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, b, a2 - b FROM t6, t7; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, b, a2 * b FROM t6, t7; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, b, a2 / b FROM t6, t7; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, b, a2 % b FROM t6, t7; | --- @@ -3024,22 +3024,22 @@ SELECT a2, b, a2 % b FROM t6, t7; SELECT a2, b, b + a2 FROM t6, t7; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, b, b - a2 FROM t6, t7; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, b, b * a2 FROM t6, t7; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, b, b / a2 FROM t6, t7; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, b, b % a2 FROM t6, t7; | --- @@ -3922,8 +3922,8 @@ SELECT a2, a2 BETWEEN 0 and 10 FROM t6; | - 'Type mismatch: can not convert integer(0) to boolean' | ... --- Check interaction of BOOLEAN and NUMBER. -CREATE TABLE t8 (c NUMBER PRIMARY KEY); +-- Check interaction of BOOLEAN and DOUBLE. +CREATE TABLE t8 (c DOUBLE PRIMARY KEY); | --- | - row_count: 1 | ... @@ -4023,13 +4023,13 @@ SELECT a2, 2.3 OR a2 FROM t6 SELECT c, true AND c FROM t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT c, false AND c FROM t8; | --- | - metadata: | - name: C - | type: number + | type: double | - name: COLUMN_1 | type: boolean | rows: @@ -4038,23 +4038,23 @@ SELECT c, false AND c FROM t8; SELECT c, true OR c FROM t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT c, false OR c FROM t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT c, c AND true FROM t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT c, c AND false FROM t8; | --- | - metadata: | - name: C - | type: number + | type: double | - name: COLUMN_1 | type: boolean | rows: @@ -4063,94 +4063,94 @@ SELECT c, c AND false FROM t8; SELECT c, c OR true FROM t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT c, c OR false FROM t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT a1, c, a1 AND c FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT a1, c, a1 OR c FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT a1, c, c AND a1 FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT a1, c, c OR a1 FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT a2, c, a2 AND c FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT a2, c, a2 OR c FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT a2, c, c AND a2 FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT a2, c, c OR a2 FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT true + 2.3; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT false + 2.3; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT true - 2.3; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT false - 2.3; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT true * 2.3; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT false * 2.3; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT true / 2.3; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT false / 2.3; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT true % 2.3; | --- @@ -4165,42 +4165,42 @@ SELECT false % 2.3; SELECT 2.3 + true; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT 2.3 + false; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT 2.3 - true; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT 2.3 - false; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT 2.3 * true; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT 2.3 * false; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT 2.3 / true; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT 2.3 / false; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT 2.3 % true; | --- @@ -4216,22 +4216,22 @@ SELECT 2.3 % false; SELECT a1, a1 + 2.3 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, a1 - 2.3 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, a1 * 2.3 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, a1 / 2.3 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, a1 % 2.3 FROM t6 | --- @@ -4241,22 +4241,22 @@ SELECT a1, a1 % 2.3 FROM t6 SELECT a1, 2.3 + a1 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, 2.3 - a1 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, 2.3 * a1 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, 2.3 / a1 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, 2.3 % a1 FROM t6 | --- @@ -4266,22 +4266,22 @@ SELECT a1, 2.3 % a1 FROM t6 SELECT a2, a2 + 2.3 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, a2 - 2.3 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, a2 * 2.3 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, a2 / 2.3 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, a2 % 2.3 FROM t6 | --- @@ -4291,22 +4291,22 @@ SELECT a2, a2 % 2.3 FROM t6 SELECT a2, 2.3 + a2 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, 2.3 - a2 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, 2.3 * a2 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, 2.3 / a2 FROM t6 | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, 2.3 % a2 FROM t6 | --- @@ -4317,92 +4317,92 @@ SELECT a2, 2.3 % a2 FROM t6 SELECT c, true + c FROM t8; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT c, false + c FROM t8; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT c, true - c FROM t8; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT c, false - c FROM t8; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT c, true * c FROM t8; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT c, false * c FROM t8; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT c, true / c FROM t8; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT c, false / c FROM t8; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT c, true % c FROM t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to integer' + | - 'Type mismatch: can not convert double(4.56) to integer' | ... SELECT c, false % c FROM t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to integer' + | - 'Type mismatch: can not convert double(4.56) to integer' | ... SELECT c, c + true FROM t8; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT c, c + false FROM t8; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT c, c - true FROM t8; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT c, c - false FROM t8; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT c, c * true FROM t8; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT c, c * false FROM t8; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT c, c / true FROM t8; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT c, c / false FROM t8; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT c, c % true FROM t8; | --- @@ -4418,47 +4418,47 @@ SELECT c, c % false FROM t8; SELECT a1, c, a1 + c FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, c, a1 - c FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, c, a1 * c FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, c, a1 / c FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, c, a1 % c FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to integer' + | - 'Type mismatch: can not convert double(4.56) to integer' | ... SELECT a1, c, c + a1 FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, c, c - a1 FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, c, c * a1 FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, c, c / a1 FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to integer, unsigned or double' | ... SELECT a1, c, c % a1 FROM t6, t8; | --- @@ -4468,47 +4468,47 @@ SELECT a1, c, c % a1 FROM t6, t8; SELECT a2, c, a2 + c FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, c, a2 - c FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, c, a2 * c FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, c, a2 / c FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, c, a2 % c FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to integer' + | - 'Type mismatch: can not convert double(4.56) to integer' | ... SELECT a2, c, c + a2 FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, c, c - a2 FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, c, c * a2 FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, c, c / a2 FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to integer, unsigned or double' | ... SELECT a2, c, c % a2 FROM t6, t8; | --- @@ -4601,22 +4601,22 @@ SELECT a2, 2.3 < a2 FROM t6 SELECT c, true > c FROM t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT c, false > c FROM t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT c, true < c FROM t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT c, false < c FROM t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT c, c > true FROM t8; | --- @@ -4642,12 +4642,12 @@ SELECT c, c < false FROM t8; SELECT a1, c, a1 > c FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT a1, c, a1 < c FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT a1, c, c > a1 FROM t6, t8; | --- @@ -4662,12 +4662,12 @@ SELECT a1, c, c < a1 FROM t6, t8; SELECT a2, c, a2 > c FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT a2, c, a2 < c FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT a2, c, c > a2 FROM t6, t8; | --- @@ -4765,22 +4765,22 @@ SELECT a2, 2.3 <= a2 FROM t6 SELECT c, true >= c FROM t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT c, false >= c FROM t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT c, true <= c FROM t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT c, false <= c FROM t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT c, c >= true FROM t8; | --- @@ -4806,12 +4806,12 @@ SELECT c, c <= false FROM t8; SELECT a1, c, a1 >= c FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT a1, c, a1 <= c FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT a1, c, c >= a1 FROM t6, t8; | --- @@ -4826,12 +4826,12 @@ SELECT a1, c, c <= a1 FROM t6, t8; SELECT a2, c, a2 >= c FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT a2, c, a2 <= c FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT a2, c, c >= a2 FROM t6, t8; | --- @@ -4929,22 +4929,22 @@ SELECT a2, 2.3 != a2 FROM t6 SELECT c, true == c FROM t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT c, false == c FROM t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT c, true != c FROM t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT c, false != c FROM t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT c, c == true FROM t8; | --- @@ -4970,12 +4970,12 @@ SELECT c, c != false FROM t8; SELECT a1, c, a1 == c FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT a1, c, a1 != c FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT a1, c, c == a1 FROM t6, t8; | --- @@ -4990,12 +4990,12 @@ SELECT a1, c, c != a1 FROM t6, t8; SELECT a2, c, a2 == c FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT a2, c, a2 != c FROM t6, t8; | --- | - null - | - 'Type mismatch: can not convert number(4.56) to boolean' + | - 'Type mismatch: can not convert double(4.56) to boolean' | ... SELECT a2, c, c == a2 FROM t6, t8; | --- @@ -5043,22 +5043,22 @@ SELECT a2 IN (0.1, 1.2, 2.3, 3.4) FROM t6 LIMIT 1; SELECT true IN (SELECT c FROM t8); | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to double' | ... SELECT false IN (SELECT c FROM t8); | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to double' | ... SELECT a1 IN (SELECT c FROM t8) FROM t6 LIMIT 1; | --- | - null - | - 'Type mismatch: can not convert boolean(FALSE) to number' + | - 'Type mismatch: can not convert boolean(FALSE) to double' | ... SELECT a2 IN (SELECT c FROM t8) FROM t6 LIMIT 1; | --- | - null - | - 'Type mismatch: can not convert boolean(TRUE) to number' + | - 'Type mismatch: can not convert boolean(TRUE) to double' | ... SELECT true BETWEEN 0.1 and 9.9; diff --git a/test/sql/boolean.test.sql b/test/sql/boolean.test.sql index 13991ca0c..12e83a4bb 100644 --- a/test/sql/boolean.test.sql +++ b/test/sql/boolean.test.sql @@ -752,8 +752,8 @@ SELECT false BETWEEN 0 and 10; SELECT a1, a1 BETWEEN 0 and 10 FROM t6; SELECT a2, a2 BETWEEN 0 and 10 FROM t6; --- Check interaction of BOOLEAN and NUMBER. -CREATE TABLE t8 (c NUMBER PRIMARY KEY); +-- Check interaction of BOOLEAN and DOUBLE. +CREATE TABLE t8 (c DOUBLE PRIMARY KEY); INSERT INTO t8 VALUES (4.56); SELECT true AND 2.3; diff --git a/test/sql/prepared.result b/test/sql/prepared.result index 0db2cc03f..ecc16f597 100644 --- a/test/sql/prepared.result +++ b/test/sql/prepared.result @@ -419,7 +419,7 @@ unprepare(s.stmt_id) | - null | ... -s = prepare("SELECT count(*), count(a - 3), max(b), abs(id) FROM test WHERE b = '3';") +s = prepare("SELECT count(*), count(id - 3), max(b), abs(id) FROM test WHERE b = '3';") | --- | ... execute(s.stmt_id) diff --git a/test/sql/prepared.test.lua b/test/sql/prepared.test.lua index d8e8a44cb..0a1fdebae 100644 --- a/test/sql/prepared.test.lua +++ b/test/sql/prepared.test.lua @@ -155,7 +155,7 @@ end; test_run:cmd("setopt delimiter ''"); unprepare(s.stmt_id) -s = prepare("SELECT count(*), count(a - 3), max(b), abs(id) FROM test WHERE b = '3';") +s = prepare("SELECT count(*), count(id - 3), max(b), abs(id) FROM test WHERE b = '3';") execute(s.stmt_id) execute(s.stmt_id) unprepare(s.stmt_id) diff --git a/test/sql/types.result b/test/sql/types.result index 592b1aa19..68bdcd62e 100644 --- a/test/sql/types.result +++ b/test/sql/types.result @@ -311,7 +311,8 @@ box.execute('SELECT 1 + 1.1;') box.execute('SELECT \'9223372036854\' + 1;') --- - null -- 'Type mismatch: can not convert string(''9223372036854'') to number' +- 'Type mismatch: can not convert string(''9223372036854'') to integer, unsigned or + double' ... -- Fix BOOLEAN bindings. box.execute('SELECT ?', {true}) -- 2.25.1