drh | 03181c8 | 2016-08-18 19:04:57 +0000 | [diff] [blame] | 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 | |
| 15 | set testdir [file dirname $argv0] |
| 16 | source $testdir/tester.tcl |
| 17 | set ::testprefix rowvalue6 |
| 18 | |
| 19 | do_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 | } {} |
| 29 | do_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 | |
| 36 | finish_test |