xref: /sqlite-3.40.0/test/rowvalue6.test (revision 03181c8c)
1# 2016-08-18
2#
3# The author disclaims copyright to this source code.  In place of
4# a legal notice, here is a blessing:
5#
6#    May you do good and not evil.
7#    May you find forgiveness for yourself and forgive others.
8#    May you share freely, never taking more than you give.
9#
10#***********************************************************************
11# The focus of this file is handling of NULL values in row-value IN
12# expressions.
13#
14
15set testdir [file dirname $argv0]
16source $testdir/tester.tcl
17set ::testprefix rowvalue6
18
19do_execsql_test 1.1 {
20  CREATE TABLE t1(a,b,c);
21  CREATE INDEX t1x1 ON t1(a,b);
22  INSERT INTO t1 VALUES(1,NULL,200);
23
24  CREATE TABLE t2(x,y,z);
25  INSERT INTO t2 VALUES(1,NULL,55);
26
27  SELECT c FROM t1 WHERE (a,b) IN (SELECT x,y FROM t2 WHERE z==55);
28} {}
29do_execsql_test 1.2 {
30  INSERT INTO t1 VALUES(2,3,400);
31  INSERT INTO t2 VALUES(2,3,55);
32
33  SELECT c FROM t1 WHERE (a,b) IN (SELECT x,y FROM t2 WHERE z==55);
34} {400}
35
36finish_test
37