From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 30A42309A3 for ; Fri, 30 Nov 2018 20:12:59 -0500 (EST) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GIRaWPQC1JDt for ; Fri, 30 Nov 2018 20:12:59 -0500 (EST) Received: from smtp55.i.mail.ru (smtp55.i.mail.ru [217.69.128.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id E3E63290E3 for ; Fri, 30 Nov 2018 20:12:58 -0500 (EST) From: Roman Khabibov Subject: [tarantool-patches] [PATCH 2/2] sql: add test for indexed char in sub subquery Date: Sat, 1 Dec 2018 04:12:51 +0300 Message-Id: <20181201011251.30573-2-roman.habibov@tarantool.org> In-Reply-To: <20181201011251.30573-1-roman.habibov@tarantool.org> References: <20181201011251.30573-1-roman.habibov@tarantool.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org Cc: v.shpilevoy@tarantool.org Add test to check result for indexed char in sub subquery. Closes #3616 Branch: https://github.com/tarantool/tarantool/tree/romanhabibov/gh-3616-char-in-sub-subquery Issue: https://github.com/tarantool/tarantool/issues/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