Tarantool development patches archive
 help / color / mirror / Atom feed
From: Roman Khabibov <roman.habibov@tarantool.org>
To: tarantool-patches@freelists.org
Cc: vdavydov.dev@gmail.com
Subject: [PATCH 3/3 v2] sql: add test for indexed char in sub subquery
Date: Wed,  5 Dec 2018 02:47:30 +0300	[thread overview]
Message-ID: <c0a53f178751392e8c2f6c4d693d2693b47fa285.1543941445.git.roman.habibov@tarantool.org> (raw)
In-Reply-To: <cover.1543941445.git.roman.habibov@tarantool.org>

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(
         -- </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

  parent reply	other threads:[~2018-12-04 23:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-04 23:47 [PATCH 0/3 " Roman Khabibov
2018-12-04 23:47 ` [PATCH 1/3 v2] sql: store CHAR|VARCHAR len as integer, not type_def Roman Khabibov
2018-12-04 23:47 ` [PATCH 2/3 v2] sql: add CHAR description without length Roman Khabibov
2018-12-04 23:47 ` Roman Khabibov [this message]
2018-12-05 20:35 ` [tarantool-patches] [PATCH 0/3 v2] sql: add test for indexed char in sub subquery Vladislav Shpilevoy
2018-12-07 11:20   ` [tarantool-patches] " n.pettik
2018-12-07 11:27     ` Vladislav Shpilevoy
2018-12-07 15:59       ` n.pettik
2018-12-08 16:49     ` roman
2018-12-08 21:21     ` roman
2018-12-08 21:56       ` n.pettik
2018-12-14  5:47 ` [tarantool-patches] " Kirill Yukhin

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=c0a53f178751392e8c2f6c4d693d2693b47fa285.1543941445.git.roman.habibov@tarantool.org \
    --to=roman.habibov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=vdavydov.dev@gmail.com \
    --subject='Re: [PATCH 3/3 v2] 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