1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

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
This commit is contained in:
danielk1977
2007-12-13 18:24:21 +00:00
parent c9a67a8c0f
commit b9fdb2c2f7
3 changed files with 74 additions and 9 deletions

View File

@ -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