From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Roman Khabibov Subject: [PATCH 3/3 v2] sql: add test for indexed char in sub subquery Date: Wed, 5 Dec 2018 02:47:30 +0300 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: tarantool-patches@freelists.org Cc: vdavydov.dev@gmail.com List-ID: Add test to check result for indexed char in sub subquery. Closes #3616 --- test/sql-tap/select6.test.lua | 91 ++++++++++++++++++++++++++++++++++- 1 file changed, 90 insertions(+), 1 deletion(-) diff --git a/test/sql-tap/select6.test.lua b/test/sql-tap/select6.test.lua index 6fdb4195e..a1fadb631 100755 --- a/test/sql-tap/select6.test.lua +++ b/test/sql-tap/select6.test.lua @@ -1,6 +1,6 @@ #!/usr/bin/env tarantool test = require("sqltester") -test:plan(83) +test:plan(88) --!./tcltestrunner.lua -- 2001 September 15 @@ -1052,5 +1052,94 @@ test:do_execsql_test( -- }) +-- gh-3616 Check result for indexed char in sub subquery. + +test:do_execsql_test( + 12.1, + [[ + DROP TABLE t1; + DROP TABLE t2; + CREATE TABLE t1 (s1 INT PRIMARY KEY, u CHAR UNIQUE); + CREATE TABLE t2 (s1 INT PRIMARY KEY, u CHAR); + INSERT INTO t1 VALUES (1,''); + INSERT INTO t2 VALUES (1,''); + SELECT COUNT(*) FROM t1 WHERE u IN + (SELECT u FROM t2 WHERE u IN (SELECT u FROM t1)); + ]], { + -- <12.1> + 1 + -- + }) + +test:do_execsql_test( + 12.2, + [[ + DROP TABLE t1; + DROP TABLE t2; + CREATE TABLE t1 (s1 INT PRIMARY KEY, u CHAR); + CREATE TABLE t2 (s1 INT PRIMARY KEY, u CHAR); + INSERT INTO t1 VALUES (1,''); + INSERT INTO t2 VALUES (1,''); + SELECT COUNT(*) FROM t1 WHERE u IN + (SELECT u FROM t2 WHERE u IN (SELECT u FROM t1)); + ]], { + -- <12.2> + 1 + -- + }) + +test:do_execsql_test( + 12.3, + [[ + DROP TABLE t1; + DROP TABLE t2; + CREATE TABLE t1 (s1 INT PRIMARY KEY, u INT UNIQUE); + CREATE TABLE t2 (s1 INT PRIMARY KEY, u INT); + INSERT INTO t1 VALUES (1, 0); + INSERT INTO t2 VALUES (1, 0); + SELECT COUNT(*) FROM t1 WHERE u IN + (SELECT u FROM t2 WHERE u IN (SELECT u FROM t1)); + ]], { + -- <12.3> + 1 + -- + }) + +test:do_execsql_test( + 12.4, + [[ + DROP TABLE t1; + DROP TABLE t2; + CREATE TABLE t1 (s1 INT PRIMARY KEY, u INT); + CREATE TABLE t2 (s1 INT PRIMARY KEY, u INT); + INSERT INTO t1 VALUES (1, 0); + INSERT INTO t2 VALUES (1, 0); + SELECT COUNT(*) FROM t1 WHERE u IN + (SELECT u FROM t2 WHERE u IN (SELECT u FROM t1)); + ]], { + -- <12.4> + 1 + -- + }) + +test:do_execsql_test( + 12.5, + [[ + DROP TABLE t1; + DROP TABLE t2; + CREATE TABLE t1 (s1 INT PRIMARY KEY, u INT); + CREATE TABLE t2 (s1 INT PRIMARY KEY, u INT); + INSERT INTO t1 VALUES (1, 0); + INSERT INTO t2 VALUES (1, 1); + SELECT COUNT(*) FROM t1 WHERE u IN + (SELECT u FROM t2 WHERE u IN (SELECT u FROM t1)); + DROP TABLE t1; + DROP TABLE t2; + ]], { + -- <12.5> + 0 + -- + }) + test:finish_test() -- 2.19.1