11
11
# This file implements regression tests for SQLite library. The
12
12
# focus of this file is testing the IN and BETWEEN operator.
14
# $Id: in.test,v 1.17 2006/05/23 23:25:10 drh Exp $
14
# $Id: in.test,v 1.19 2008/01/16 18:20:42 danielk1977 Exp $
16
16
set testdir [file dirname $argv0]
17
17
source $testdir/tester.tcl
24
24
CREATE TABLE t1(a int, b int);
26
26
for {set i 1} {$i<=10} {incr i} {
27
execsql "INSERT INTO t1 VALUES($i,[expr {int(pow(2,$i))}])"
27
execsql "INSERT INTO t1 VALUES($i,[expr {1<<$i}])"
367
# Test error conditions with expressions of the form IN(<compound select>).
371
CREATE TABLE t2(a, b, c);
372
CREATE TABLE t3(a, b, c);
377
SELECT * FROM t2 WHERE a IN (
378
SELECT a, b FROM t3 UNION ALL SELECT a, b FROM t2
381
} {1 {only a single result allowed for a SELECT that is part of an expression}}
384
SELECT * FROM t2 WHERE a IN (
385
SELECT a, b FROM t3 UNION SELECT a, b FROM t2
388
} {1 {only a single result allowed for a SELECT that is part of an expression}}
391
SELECT * FROM t2 WHERE a IN (
392
SELECT a, b FROM t3 EXCEPT SELECT a, b FROM t2
395
} {1 {only a single result allowed for a SELECT that is part of an expression}}
398
SELECT * FROM t2 WHERE a IN (
399
SELECT a, b FROM t3 INTERSECT SELECT a, b FROM t2
402
} {1 {only a single result allowed for a SELECT that is part of an expression}}
405
SELECT * FROM t2 WHERE a IN (
406
SELECT a FROM t3 UNION ALL SELECT a, b FROM t2
409
} {1 {only a single result allowed for a SELECT that is part of an expression}}
412
SELECT * FROM t2 WHERE a IN (
413
SELECT a FROM t3 UNION SELECT a, b FROM t2
416
} {1 {SELECTs to the left and right of UNION do not have the same number of result columns}}
419
SELECT * FROM t2 WHERE a IN (
420
SELECT a FROM t3 EXCEPT SELECT a, b FROM t2
423
} {1 {SELECTs to the left and right of EXCEPT do not have the same number of result columns}}
426
SELECT * FROM t2 WHERE a IN (
427
SELECT a FROM t3 INTERSECT SELECT a, b FROM t2
430
} {1 {SELECTs to the left and right of INTERSECT do not have the same number of result columns}}