Index: test/in.test ================================================================== --- test/in.test +++ test/in.test @@ -9,11 +9,11 @@ # #*********************************************************************** # 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 # Generate the test data we will need for the first squences of tests. @@ -362,6 +362,71 @@ execsql { SELECT * FROM t6 WHERE +a IN ('2'); } } {} +# Test error conditions with expressions of the form IN(). +# +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