aboutsummaryrefslogtreecommitdiff
path: root/test/where2.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/where2.test')
-rw-r--r--test/where2.test11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/where2.test b/test/where2.test
index 3d4dfc912..c827ecc7b 100644
--- a/test/where2.test
+++ b/test/where2.test
@@ -699,5 +699,16 @@ do_test where2-11.4 {
}
} {4 8 10}
+# Verify that the OR clause is used in an outer loop even when
+# the OR clause scores slightly better on an inner loop.
+do_execsql_test where2-12.1 {
+ CREATE TABLE t12(x INTEGER PRIMARY KEY, y);
+ CREATE INDEX t12y ON t12(y);
+ EXPLAIN QUERY PLAN
+ SELECT a.x, b.x
+ FROM t12 AS a JOIN t12 AS b ON a.y=b.x
+ WHERE (b.x=$abc OR b.y=$abc);
+} {/.*SEARCH TABLE t12 AS b .*SEARCH TABLE t12 AS b .*/}
+
finish_test