diff options
author | danielk1977 <danielk1977@noemail.net> | 2007-12-13 18:24:21 +0000 |
---|---|---|
committer | danielk1977 <danielk1977@noemail.net> | 2007-12-13 18:24:21 +0000 |
commit | b9fdb2c2f718d8b3ba9304d3f908e5f12e8ccc95 (patch) | |
tree | 40b8b9204e598d52a2f48f13f12048324dfec8ea /test/in.test | |
parent | c9a67a8c0f8ce866567fbd66ad5a74110f15f6fa (diff) | |
download | sqlite-b9fdb2c2f718d8b3ba9304d3f908e5f12e8ccc95.tar.gz sqlite-b9fdb2c2f718d8b3ba9304d3f908e5f12e8ccc95.zip |
Add test cases for errors in "IN(SELECT ...)" expressions where the SELECT statement is a compound SELECT. No faults found. (CVS 4626)
FossilOrigin-Name: 49b67adfe9f15dfac34cb30f965920bf61bceee7
Diffstat (limited to 'test/in.test')
-rw-r--r-- | test/in.test | 67 |
1 files changed, 66 insertions, 1 deletions
diff --git a/test/in.test b/test/in.test index 84147fded..6d6af2786 100644 --- a/test/in.test +++ b/test/in.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing the IN and BETWEEN operator. # -# $Id: in.test,v 1.17 2006/05/23 23:25:10 drh Exp $ +# $Id: in.test,v 1.18 2007/12/13 18:24:22 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -364,4 +364,69 @@ do_test in-11.6 { } } {} +# Test error conditions with expressions of the form IN(<compound select>). +# +do_test in-12.1 { + execsql { + CREATE TABLE t2(a, b, c); + CREATE TABLE t3(a, b, c); + } +} {} +do_test in-12.2 { + catchsql { + SELECT * FROM t2 WHERE a IN ( + SELECT a, b FROM t3 UNION ALL SELECT a, b FROM t2 + ); + } +} {1 {only a single result allowed for a SELECT that is part of an expression}} +do_test in-12.3 { + catchsql { + SELECT * FROM t2 WHERE a IN ( + SELECT a, b FROM t3 UNION SELECT a, b FROM t2 + ); + } +} {1 {only a single result allowed for a SELECT that is part of an expression}} +do_test in-12.4 { + catchsql { + SELECT * FROM t2 WHERE a IN ( + SELECT a, b FROM t3 EXCEPT SELECT a, b FROM t2 + ); + } +} {1 {only a single result allowed for a SELECT that is part of an expression}} +do_test in-12.5 { + catchsql { + SELECT * FROM t2 WHERE a IN ( + SELECT a, b FROM t3 INTERSECT SELECT a, b FROM t2 + ); + } +} {1 {only a single result allowed for a SELECT that is part of an expression}} +do_test in-12.6 { + catchsql { + SELECT * FROM t2 WHERE a IN ( + SELECT a FROM t3 UNION ALL SELECT a, b FROM t2 + ); + } +} {1 {only a single result allowed for a SELECT that is part of an expression}} +do_test in-12.7 { + catchsql { + SELECT * FROM t2 WHERE a IN ( + SELECT a FROM t3 UNION SELECT a, b FROM t2 + ); + } +} {1 {SELECTs to the left and right of UNION do not have the same number of result columns}} +do_test in-12.8 { + catchsql { + SELECT * FROM t2 WHERE a IN ( + SELECT a FROM t3 EXCEPT SELECT a, b FROM t2 + ); + } +} {1 {SELECTs to the left and right of EXCEPT do not have the same number of result columns}} +do_test in-12.9 { + catchsql { + SELECT * FROM t2 WHERE a IN ( + SELECT a FROM t3 INTERSECT SELECT a, b FROM t2 + ); + } +} {1 {SELECTs to the left and right of INTERSECT do not have the same number of result columns}} + finish_test |