aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/sqlite/unix/sqlite-3.5.1/test/tkt2640.test
diff options
context:
space:
mode:
authordan miller2007-10-20 02:49:29 +0000
committerdan miller2007-10-20 02:49:29 +0000
commite36d23a85ebff914d74bb541558c2b6082b78edb (patch)
tree54b58fdf162e78af64055282a6035c8d2443389d /libraries/sqlite/unix/sqlite-3.5.1/test/tkt2640.test
parent* Fixed an issue whereby avatar chat distances were being calculated against ... (diff)
downloadopensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.zip
opensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.tar.gz
opensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.tar.bz2
opensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.tar.xz
sqlite source (unix build) added to libraries
Diffstat (limited to 'libraries/sqlite/unix/sqlite-3.5.1/test/tkt2640.test')
-rw-r--r--libraries/sqlite/unix/sqlite-3.5.1/test/tkt2640.test119
1 files changed, 119 insertions, 0 deletions
diff --git a/libraries/sqlite/unix/sqlite-3.5.1/test/tkt2640.test b/libraries/sqlite/unix/sqlite-3.5.1/test/tkt2640.test
new file mode 100644
index 0000000..d2fa0e6
--- /dev/null
+++ b/libraries/sqlite/unix/sqlite-3.5.1/test/tkt2640.test
@@ -0,0 +1,119 @@
1# 2007 Sep 12
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#
12# This file is to test that ticket #2640 has been fixed.
13#
14# $Id: tkt2640.test,v 1.1 2007/09/12 15:41:01 drh Exp $
15#
16
17# The problem in ticket #2640 was that the query optimizer was
18# not recognizing all uses of tables within subqueries in the
19# WHERE clause. If the subquery contained a compound SELECT,
20# then tables that were used by terms of the compound other than
21# the last term would not be recognized as dependencies.
22# So if one of the SELECT statements within a compound made
23# use of a table that occurs later in a join, the query
24# optimizer would not recognize this and would try to evaluate
25# the subquery too early, before that tables value had been
26# established.
27
28set testdir [file dirname $argv0]
29source $testdir/tester.tcl
30
31do_test tkt2640-1.1 {
32 execsql {
33 CREATE TABLE persons(person_id, name);
34 INSERT INTO persons VALUES(1,'fred');
35 INSERT INTO persons VALUES(2,'barney');
36 INSERT INTO persons VALUES(3,'wilma');
37 INSERT INTO persons VALUES(4,'pebbles');
38 INSERT INTO persons VALUES(5,'bambam');
39 CREATE TABLE directors(person_id);
40 INSERT INTO directors VALUES(5);
41 INSERT INTO directors VALUES(3);
42 CREATE TABLE writers(person_id);
43 INSERT INTO writers VALUES(2);
44 INSERT INTO writers VALUES(3);
45 INSERT INTO writers VALUES(4);
46 SELECT DISTINCT p.name
47 FROM persons p, directors d
48 WHERE d.person_id=p.person_id
49 AND NOT EXISTS (
50 SELECT person_id FROM directors d1 WHERE d1.person_id=p.person_id
51 EXCEPT
52 SELECT person_id FROM writers w
53 );
54 }
55} {wilma}
56do_test tkt2640-1.2 {
57 execsql {
58 SELECT DISTINCT p.name
59 FROM persons p CROSS JOIN directors d
60 WHERE d.person_id=p.person_id
61 AND NOT EXISTS (
62 SELECT person_id FROM directors d1 WHERE d1.person_id=p.person_id
63 EXCEPT
64 SELECT person_id FROM writers w
65 );
66 }
67} {wilma}
68do_test tkt2640-1.3 {
69 execsql {
70 SELECT DISTINCT p.name
71 FROM directors d CROSS JOIN persons p
72 WHERE d.person_id=p.person_id
73 AND NOT EXISTS (
74 SELECT person_id FROM directors d1 WHERE d1.person_id=p.person_id
75 EXCEPT
76 SELECT person_id FROM writers w
77 );
78 }
79} {wilma}
80do_test tkt2640-1.4 {
81 execsql {
82 SELECT DISTINCT p.name
83 FROM persons p, directors d
84 WHERE d.person_id=p.person_id
85 AND NOT EXISTS (
86 SELECT person_id FROM directors d1 WHERE d1.person_id=d.person_id
87 EXCEPT
88 SELECT person_id FROM writers w
89 );
90 }
91} {wilma}
92do_test tkt2640-1.5 {
93 execsql {
94 SELECT DISTINCT p.name
95 FROM persons p CROSS JOIN directors d
96 WHERE d.person_id=p.person_id
97 AND NOT EXISTS (
98 SELECT person_id FROM directors d1 WHERE d1.person_id=d.person_id
99 EXCEPT
100 SELECT person_id FROM writers w
101 );
102 }
103} {wilma}
104do_test tkt2640-1.6 {
105 execsql {
106 SELECT DISTINCT p.name
107 FROM directors d CROSS JOIN persons p
108 WHERE d.person_id=p.person_id
109 AND NOT EXISTS (
110 SELECT person_id FROM directors d1 WHERE d1.person_id=d.person_id
111 EXCEPT
112 SELECT person_id FROM writers w
113 );
114 }
115} {wilma}
116
117
118
119finish_test