~ubuntu-branches/ubuntu/maverick/sqlite3/maverick-updates

« back to all changes in this revision

Viewing changes to test/in.test

  • Committer: Bazaar Package Importer
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2008-10-01 20:16:18 UTC
  • mfrom: (3.1.20 intrepid)
  • Revision ID: james.westby@ubuntu.com-20081001201618-yfvqqj1qs29wdtcc
Tags: 3.5.9-5
Backport fix for distinct on indexes (closes: #500792).

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
# This file implements regression tests for SQLite library.  The
12
12
# focus of this file is testing the IN and BETWEEN operator.
13
13
#
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 $
15
15
 
16
16
set testdir [file dirname $argv0]
17
17
source $testdir/tester.tcl
24
24
    CREATE TABLE t1(a int, b int);
25
25
  }
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}])"
28
28
  }
29
29
  execsql {
30
30
    COMMIT;
364
364
  }
365
365
} {}
366
366
 
 
367
# Test error conditions with expressions of the form IN(<compound select>).
 
368
#
 
369
do_test in-12.1 {
 
370
  execsql {
 
371
    CREATE TABLE t2(a, b, c);
 
372
    CREATE TABLE t3(a, b, c);
 
373
  }
 
374
} {}
 
375
do_test in-12.2 {
 
376
  catchsql {
 
377
    SELECT * FROM t2 WHERE a IN (
 
378
      SELECT a, b FROM t3 UNION ALL SELECT a, b FROM t2
 
379
    );
 
380
  }
 
381
} {1 {only a single result allowed for a SELECT that is part of an expression}}
 
382
do_test in-12.3 {
 
383
  catchsql {
 
384
    SELECT * FROM t2 WHERE a IN (
 
385
      SELECT a, b FROM t3 UNION SELECT a, b FROM t2
 
386
    );
 
387
  }
 
388
} {1 {only a single result allowed for a SELECT that is part of an expression}}
 
389
do_test in-12.4 {
 
390
  catchsql {
 
391
    SELECT * FROM t2 WHERE a IN (
 
392
      SELECT a, b FROM t3 EXCEPT SELECT a, b FROM t2
 
393
    );
 
394
  }
 
395
} {1 {only a single result allowed for a SELECT that is part of an expression}}
 
396
do_test in-12.5 {
 
397
  catchsql {
 
398
    SELECT * FROM t2 WHERE a IN (
 
399
      SELECT a, b FROM t3 INTERSECT SELECT a, b FROM t2
 
400
    );
 
401
  }
 
402
} {1 {only a single result allowed for a SELECT that is part of an expression}}
 
403
do_test in-12.6 {
 
404
  catchsql {
 
405
    SELECT * FROM t2 WHERE a IN (
 
406
      SELECT a FROM t3 UNION ALL SELECT a, b FROM t2
 
407
    );
 
408
  }
 
409
} {1 {only a single result allowed for a SELECT that is part of an expression}}
 
410
do_test in-12.7 {
 
411
  catchsql {
 
412
    SELECT * FROM t2 WHERE a IN (
 
413
      SELECT a FROM t3 UNION SELECT a, b FROM t2
 
414
    );
 
415
  }
 
416
} {1 {SELECTs to the left and right of UNION do not have the same number of result columns}}
 
417
do_test in-12.8 {
 
418
  catchsql {
 
419
    SELECT * FROM t2 WHERE a IN (
 
420
      SELECT a FROM t3 EXCEPT SELECT a, b FROM t2
 
421
    );
 
422
  }
 
423
} {1 {SELECTs to the left and right of EXCEPT do not have the same number of result columns}}
 
424
do_test in-12.9 {
 
425
  catchsql {
 
426
    SELECT * FROM t2 WHERE a IN (
 
427
      SELECT a FROM t3 INTERSECT SELECT a, b FROM t2
 
428
    );
 
429
  }
 
430
} {1 {SELECTs to the left and right of INTERSECT do not have the same number of result columns}}
 
431
 
367
432
finish_test