Index: third_party/sqlite/src/test/where6.test |
diff --git a/third_party/sqlite/src/test/where6.test b/third_party/sqlite/src/test/where6.test |
index bcea6540a5f4f3fd8082dd3f9d9fc9c5e25e1444..83e975b7dd6d1be9879166ff3fafb0d217b91e31 100644 |
--- a/third_party/sqlite/src/test/where6.test |
+++ b/third_party/sqlite/src/test/where6.test |
@@ -127,4 +127,28 @@ do_test where6-2.14 { |
} |
} {1 3 1 3} |
+# Ticket [ebdbadade5b]: |
+# If the ON close on a LEFT JOIN is of the form x=y where both x and y |
+# are indexed columns on tables to left of the join, then do not use that |
+# term with indices to either table. |
+# |
+do_test where6-3.1 { |
+ db eval { |
+ CREATE TABLE t4(x UNIQUE); |
+ INSERT INTO t4 VALUES('abc'); |
+ INSERT INTO t4 VALUES('def'); |
+ INSERT INTO t4 VALUES('ghi'); |
+ CREATE TABLE t5(a, b, c, PRIMARY KEY(a,b)); |
+ INSERT INTO t5 VALUES('abc','def',123); |
+ INSERT INTO t5 VALUES('def','ghi',456); |
+ |
+ SELECT t4a.x, t4b.x, t5.c, t6.v |
+ FROM t4 AS t4a |
+ INNER JOIN t4 AS t4b |
+ LEFT JOIN t5 ON t5.a=t4a.x AND t5.b=t4b.x |
+ LEFT JOIN (SELECT 1 AS v) AS t6 ON t4a.x=t4b.x |
+ ORDER BY 1, 2, 3; |
+ } |
+} {abc abc {} 1 abc def 123 {} abc ghi {} {} def abc {} {} def def {} 1 def ghi 456 {} ghi abc {} {} ghi def {} {} ghi ghi {} 1} |
+ |
finish_test |