1: # 2011 July 8
2: #
3: # The author disclaims copyright to this source code. In place of
4: # a legal notice, here is a blessing:
5: #
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.
9: #
10: #***********************************************************************
11: # This file implements regression tests for SQLite library. The
12: # focus of this file is testing that bug [54844eea3f] has been fixed.
13: #
14:
15: set testdir [file dirname $argv0]
16: source $testdir/tester.tcl
17:
18: set ::testprefix tkt-54844eea3f
19:
20: do_test 1.0 {
21: execsql {
22: CREATE TABLE t1(a INTEGER PRIMARY KEY);
23: INSERT INTO t1 VALUES(1);
24: INSERT INTO t1 VALUES(4);
25:
26: CREATE TABLE t2(b INTEGER PRIMARY KEY);
27: INSERT INTO t2 VALUES(1);
28: INSERT INTO t2 VALUES(2);
29: INSERT INTO t2 SELECT b+2 FROM t2;
30: INSERT INTO t2 SELECT b+4 FROM t2;
31: INSERT INTO t2 SELECT b+8 FROM t2;
32: INSERT INTO t2 SELECT b+16 FROM t2;
33:
34: CREATE TABLE t3(c INTEGER PRIMARY KEY);
35: INSERT INTO t3 VALUES(1);
36: INSERT INTO t3 VALUES(2);
37: INSERT INTO t3 VALUES(3);
38: }
39: } {}
40:
41: do_test 1.1 {
42: execsql {
43: SELECT 'test-2', t3.c, (
44: SELECT count(*)
45: FROM t1 JOIN (SELECT DISTINCT t3.c AS p FROM t2) AS x ON t1.a=x.p
46: )
47: FROM t3;
48: }
49: } {test-2 1 1 test-2 2 0 test-2 3 0}
50:
51: do_test 1.2 {
52: execsql {
53: CREATE TABLE t4(a, b, c);
54: INSERT INTO t4 VALUES('a', 1, 'one');
55: INSERT INTO t4 VALUES('a', 2, 'two');
56: INSERT INTO t4 VALUES('b', 1, 'three');
57: INSERT INTO t4 VALUES('b', 2, 'four');
58: SELECT (
59: SELECT c FROM (
60: SELECT * FROM t4 WHERE a=out.a ORDER BY b LIMIT 10 OFFSET 1
61: ) WHERE b=out.b
62: ) FROM t4 AS out;
63: }
64: } {{} two {} four}
65:
66:
67: finish_test
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>