| OLD | NEW |
| 1 # 2010 December 6 | 1 # 2010 December 6 |
| 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 #*********************************************************************** |
| 11 # This file implements regression tests for SQLite library. Specifically, | 11 # This file implements regression tests for SQLite library. Specifically, |
| 12 # it tests that ticket [80ba201079ea608071d22a57856b940ea3ac53ce] is | 12 # it tests that ticket [80ba201079ea608071d22a57856b940ea3ac53ce] is |
| 13 # resolved. That ticket is about an incorrect result that appears when | 13 # resolved. That ticket is about an incorrect result that appears when |
| 14 # an index is added. The root cause is that a constant is being used | 14 # an index is added. The root cause is that a constant is being used |
| 15 # without initialization when the OR optimization applies in the WHERE clause. | 15 # without initialization when the OR optimization applies in the WHERE clause. |
| 16 # | 16 # |
| 17 | 17 |
| 18 set testdir [file dirname $argv0] | 18 set testdir [file dirname $argv0] |
| 19 source $testdir/tester.tcl | 19 source $testdir/tester.tcl |
| 20 set ::testprefix tkt-80ba2 | 20 set ::testprefix tkt-80ba201079 |
| 21 | 21 |
| 22 do_test tkt-80ba2-100 { | 22 do_test tkt-80ba2-100 { |
| 23 db eval { | 23 db eval { |
| 24 CREATE TABLE t1(a); | 24 CREATE TABLE t1(a); |
| 25 INSERT INTO t1 VALUES('A'); | 25 INSERT INTO t1 VALUES('A'); |
| 26 CREATE TABLE t2(b); | 26 CREATE TABLE t2(b); |
| 27 INSERT INTO t2 VALUES('B'); | 27 INSERT INTO t2 VALUES('B'); |
| 28 CREATE TABLE t3(c); | 28 CREATE TABLE t3(c); |
| 29 INSERT INTO t3 VALUES('C'); | 29 INSERT INTO t3 VALUES('C'); |
| 30 SELECT * FROM t1, t2 | 30 SELECT * FROM t1, t2 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 (a='A' AND d='E') OR | 157 (a='A' AND d='E') OR |
| 158 (b='B' AND c IN ('C', 'D', 'E')) | 158 (b='B' AND c IN ('C', 'D', 'E')) |
| 159 } {A B C D E} | 159 } {A B C D E} |
| 160 | 160 |
| 161 do_execsql_test 303 { | 161 do_execsql_test 303 { |
| 162 SELECT * FROM t1, t2 WHERE | 162 SELECT * FROM t1, t2 WHERE |
| 163 (a='A' AND d='E') OR | 163 (a='A' AND d='E') OR |
| 164 (b='B' AND c IN (SELECT c FROM t1)) | 164 (b='B' AND c IN (SELECT c FROM t1)) |
| 165 } {A B C D E} | 165 } {A B C D E} |
| 166 | 166 |
| 167 do_execsql_test 304 { | 167 ifcapable compound { |
| 168 SELECT * FROM t1, t2 WHERE | 168 do_execsql_test 304 { |
| 169 (a='A' AND d='E') OR | 169 SELECT * FROM t1, t2 WHERE |
| 170 (b='B' AND c IN (SELECT 'B' UNION SELECT 'C' UNION SELECT 'D')) | 170 (a='A' AND d='E') OR |
| 171 } {A B C D E} | 171 (b='B' AND c IN (SELECT 'B' UNION SELECT 'C' UNION SELECT 'D')) |
| 172 } {A B C D E} |
| 173 } |
| 172 | 174 |
| 173 do_execsql_test 305 { | 175 do_execsql_test 305 { |
| 174 SELECT * FROM t1, t2 WHERE | 176 SELECT * FROM t1, t2 WHERE |
| 175 (b='B' AND c IN ('C', 'D', 'E')) OR | 177 (b='B' AND c IN ('C', 'D', 'E')) OR |
| 176 (a='A' AND d='E') | 178 (a='A' AND d='E') |
| 177 } {A B C D E} | 179 } {A B C D E} |
| 178 | 180 |
| 179 do_execsql_test 306 { | 181 do_execsql_test 306 { |
| 180 SELECT * FROM t1, t2 WHERE | 182 SELECT * FROM t1, t2 WHERE |
| 181 (b='B' AND c IN (SELECT c FROM t1)) OR | 183 (b='B' AND c IN (SELECT c FROM t1)) OR |
| 182 (a='A' AND d='E') | 184 (a='A' AND d='E') |
| 183 } {A B C D E} | 185 } {A B C D E} |
| 184 | 186 |
| 185 do_execsql_test 307 { | 187 ifcapable compound { |
| 186 SELECT * FROM t1, t2 WHERE | 188 do_execsql_test 307 { |
| 187 (b='B' AND c IN (SELECT 'B' UNION SELECT 'C' UNION SELECT 'D')) OR | 189 SELECT * FROM t1, t2 WHERE |
| 188 (a='A' AND d='E') | 190 (b='B' AND c IN (SELECT 'B' UNION SELECT 'C' UNION SELECT 'D')) OR |
| 189 } {A B C D E} | 191 (a='A' AND d='E') |
| 192 } {A B C D E} |
| 193 } |
| 190 | 194 |
| 191 finish_test | 195 finish_test |
| OLD | NEW |