Tarantool development patches archive
 help / color / mirror / Atom feed
From: Roman Khabibov <roman.habibov@tarantool.org>
To: tarantool-patches@freelists.org
Cc: v.shpilevoy@tarantool.org
Subject: [tarantool-patches] [PATCH 2/2] sql: add test for indexed char in sub subquery
Date: Sat,  1 Dec 2018 04:12:51 +0300	[thread overview]
Message-ID: <20181201011251.30573-2-roman.habibov@tarantool.org> (raw)
In-Reply-To: <20181201011251.30573-1-roman.habibov@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(
         -- </11.100>
     })
 
+-- 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
+        -- </12.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
+        -- </12.2>
+    })
+
+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
+        -- </12.3>
+    })
+
+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
+        -- </12.4>
+    })
+
+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
+        -- </12.5>
+    })
+
 test:finish_test()
 
-- 
2.19.1

  reply	other threads:[~2018-12-01  1:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-01  1:12 [tarantool-patches] [PATCH 1/2] sql: add CHAR description without length Roman Khabibov
2018-12-01  1:12 ` Roman Khabibov [this message]
2018-12-03 13:48 ` [tarantool-patches] " Vladislav Shpilevoy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181201011251.30573-2-roman.habibov@tarantool.org \
    --to=roman.habibov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [tarantool-patches] [PATCH 2/2] sql: add test for indexed char in sub subquery' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox