/ Check-in [49b67adf]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add test cases for errors in "IN(SELECT ...)" expressions where the SELECT statement is a compound SELECT. No faults found. (CVS 4626)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 49b67adfe9f15dfac34cb30f965920bf61bceee7
User & Date: danielk1977 2007-12-13 18:24:22
Context
2007-12-13
18:29
Fix the location of a #include in test_thread.c. ticket #2826. (CVS 4627) check-in: 6129fce8 user: drh tags: trunk
18:24
Add test cases for errors in "IN(SELECT ...)" expressions where the SELECT statement is a compound SELECT. No faults found. (CVS 4626) check-in: 49b67adf user: danielk1977 tags: trunk
18:20
Add new makefile target for "testcli" that builds a CLI using individual source files instead of the amalgamation. Ticket #2838. (CVS 4625) check-in: b6f04e5b user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/in.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    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.18 2007/12/13 18:24:22 danielk1977 Exp $
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
    18     18   
    19     19   # Generate the test data we will need for the first squences of tests.
    20     20   #
    21     21   do_test in-1.0 {
................................................................................
   360    360   do_test in-11.6 {
   361    361     # No coercion because column a as affinity NONE
   362    362     execsql {
   363    363       SELECT * FROM t6 WHERE +a IN ('2');
   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