summaryrefslogtreecommitdiff
path: root/test/where9.test
diff options
context:
space:
mode:
authorHans-Christoph Steiner <hans@eds.org>2012-09-20 18:34:42 -0400
committerHans-Christoph Steiner <hans@eds.org>2012-09-20 18:34:42 -0400
commit734b4f890763e4efafe865ba476c43cc8d1a2214 (patch)
treed561d2fad0788619f4b8e230073f6af1d416934e /test/where9.test
parent396b08286e7bb56e0e6440aaf1345c18e72ee22e (diff)
parent487e15dc239ccdb3344d1c99ce120e872bab4a74 (diff)
Merge tag 'upstream/2.0.6'
Upstream version 2.0.6
Diffstat (limited to 'test/where9.test')
-rw-r--r--test/where9.test30
1 files changed, 25 insertions, 5 deletions
diff --git a/test/where9.test b/test/where9.test
index b4a2d8d..23260a6 100644
--- a/test/where9.test
+++ b/test/where9.test
@@ -15,7 +15,7 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
-ifcapable !or_opt {
+ifcapable !or_opt||!compound {
finish_test
return
}
@@ -364,7 +364,7 @@ ifcapable explain {
} {
0 0 0 {SEARCH TABLE t1 USING INTEGER PRIMARY KEY (rowid=?) (~1 rows)}
0 1 1 {SEARCH TABLE t2 USING INDEX t2d (d=?) (~2 rows)}
- 0 1 1 {SEARCH TABLE t2 USING COVERING INDEX t2f (f=?) (~5 rows)}
+ 0 1 1 {SEARCH TABLE t2 USING COVERING INDEX t2f (f=?) (~10 rows)}
}
do_execsql_test where9-3.2 {
EXPLAIN QUERY PLAN
@@ -374,7 +374,7 @@ ifcapable explain {
} {
0 0 0 {SEARCH TABLE t1 USING INTEGER PRIMARY KEY (rowid=?) (~1 rows)}
0 1 1 {SEARCH TABLE t2 USING INDEX t2d (d=?) (~2 rows)}
- 0 1 1 {SEARCH TABLE t2 USING COVERING INDEX t2f (f=?) (~5 rows)}
+ 0 1 1 {SEARCH TABLE t2 USING COVERING INDEX t2f (f=?) (~10 rows)}
}
}
@@ -453,8 +453,8 @@ ifcapable explain {
do_execsql_test where9-5.1 {
EXPLAIN QUERY PLAN SELECT a FROM t1 WHERE b>1000 AND (c=31031 OR d IS NULL)
} {
- 0 0 0 {SEARCH TABLE t1 USING INDEX t1c (c=?) (~2 rows)}
- 0 0 0 {SEARCH TABLE t1 USING INDEX t1d (d=?) (~2 rows)}
+ 0 0 0 {SEARCH TABLE t1 USING INDEX t1c (c=?) (~3 rows)}
+ 0 0 0 {SEARCH TABLE t1 USING INDEX t1d (d=?) (~3 rows)}
}
# In contrast, b=1000 is preferred over any OR-clause.
@@ -856,5 +856,25 @@ do_test where9-7.3.2 {
}
} {79 81}
+# Fix for ticket [b7c8682cc17f32903f03a610bd0d35ffd3c1e6e4]
+# "Incorrect result from LEFT JOIN with OR in the WHERE clause"
+#
+do_test where9-8.1 {
+ db eval {
+ CREATE TABLE t81(a INTEGER PRIMARY KEY, b, c, d);
+ CREATE TABLE t82(x INTEGER PRIMARY KEY, y);
+ CREATE TABLE t83(p INTEGER PRIMARY KEY, q);
+
+ INSERT INTO t81 VALUES(2,3,4,5);
+ INSERT INTO t81 VALUES(3,4,5,6);
+ INSERT INTO t82 VALUES(2,4);
+ INSERT INTO t83 VALUES(5,55);
+
+ SELECT *
+ FROM t81 LEFT JOIN t82 ON y=b JOIN t83
+ WHERE c==p OR d==p
+ ORDER BY +a;
+ }
+} {2 3 4 5 {} {} 5 55 3 4 5 6 2 4 5 55}
finish_test