3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give.
10 #***********************************************************************
12 # This file implements regression tests for SQLite library.
13 # Specifically, it tests that bug #3334 has been fixed by the
14 # addition of restriction (19) to the subquery flattener optimization.
16 # $Id: tkt3334.test,v 1.1 2008/08/26 12:56:14 drh Exp $
19 set testdir [file dirname $argv0]
20 source $testdir/tester.tcl
25 INSERT INTO t1 VALUES(1,934);
26 INSERT INTO t1 VALUES(2,221);
27 INSERT INTO t1 VALUES(1,372);
28 INSERT INTO t1 VALUES(3,552);
29 INSERT INTO t1 VALUES(1,719);
30 INSERT INTO t1 VALUES(4,102);
31 SELECT * FROM t1 ORDER BY b;
33 } {4 102 2 221 1 372 3 552 1 719 1 934}
37 SELECT a FROM (SELECT a FROM t1 ORDER BY b LIMIT 2) WHERE a=1;
42 SELECT count(*) FROM (SELECT a FROM t1 ORDER BY b LIMIT 2) WHERE a=1;
47 SELECT a FROM (SELECT a FROM t1 ORDER BY b LIMIT 3) WHERE a=1;
52 SELECT count(*) FROM (SELECT a FROM t1 ORDER BY b LIMIT 3) WHERE a=1;
57 SELECT a FROM (SELECT a FROM t1 ORDER BY b LIMIT 99) WHERE a=1;
62 SELECT count(*) FROM (SELECT a FROM t1 ORDER BY b LIMIT 99) WHERE a=1;
67 SELECT a FROM (SELECT a FROM t1 ORDER BY b) WHERE a=1;
72 SELECT count(*) FROM (SELECT a FROM t1 ORDER BY b) WHERE a=1;
77 SELECT a FROM (SELECT a FROM t1) WHERE a=1;
80 do_test tkt3334-1.10 {
82 SELECT count(*) FROM (SELECT a FROM t1) WHERE a=1;