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