OLD | NEW |
1 # 2007 June 8 | 1 # 2007 June 8 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 execsql { | 120 execsql { |
121 SELECT * FROM t1 LEFT JOIN t2 ON x=b WHERE 1=c; | 121 SELECT * FROM t1 LEFT JOIN t2 ON x=b WHERE 1=c; |
122 } | 122 } |
123 } {1 3 1 3} | 123 } {1 3 1 3} |
124 do_test where6-2.14 { | 124 do_test where6-2.14 { |
125 execsql { | 125 execsql { |
126 SELECT * FROM t1 LEFT JOIN t2 ON b=x WHERE 1=c; | 126 SELECT * FROM t1 LEFT JOIN t2 ON b=x WHERE 1=c; |
127 } | 127 } |
128 } {1 3 1 3} | 128 } {1 3 1 3} |
129 | 129 |
| 130 # Ticket [ebdbadade5b]: |
| 131 # If the ON close on a LEFT JOIN is of the form x=y where both x and y |
| 132 # are indexed columns on tables to left of the join, then do not use that |
| 133 # term with indices to either table. |
| 134 # |
| 135 do_test where6-3.1 { |
| 136 db eval { |
| 137 CREATE TABLE t4(x UNIQUE); |
| 138 INSERT INTO t4 VALUES('abc'); |
| 139 INSERT INTO t4 VALUES('def'); |
| 140 INSERT INTO t4 VALUES('ghi'); |
| 141 CREATE TABLE t5(a, b, c, PRIMARY KEY(a,b)); |
| 142 INSERT INTO t5 VALUES('abc','def',123); |
| 143 INSERT INTO t5 VALUES('def','ghi',456); |
| 144 |
| 145 SELECT t4a.x, t4b.x, t5.c, t6.v |
| 146 FROM t4 AS t4a |
| 147 INNER JOIN t4 AS t4b |
| 148 LEFT JOIN t5 ON t5.a=t4a.x AND t5.b=t4b.x |
| 149 LEFT JOIN (SELECT 1 AS v) AS t6 ON t4a.x=t4b.x |
| 150 ORDER BY 1, 2, 3; |
| 151 } |
| 152 } {abc abc {} 1 abc def 123 {} abc ghi {} {} def abc {} {} def def {} 1 def ghi
456 {} ghi abc {} {} ghi def {} {} ghi ghi {} 1} |
| 153 |
130 finish_test | 154 finish_test |
OLD | NEW |