OLD | NEW |
1 # 2012 September 18 | 1 # 2012 September 18 |
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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 } {2} | 176 } {2} |
177 | 177 |
178 do_execsql_test 6.3.1 { | 178 do_execsql_test 6.3.1 { |
179 CREATE TABLE x1(a); | 179 CREATE TABLE x1(a); |
180 CREATE TABLE x2(b); | 180 CREATE TABLE x2(b); |
181 INSERT INTO x1 VALUES(1), (1), (2); | 181 INSERT INTO x1 VALUES(1), (1), (2); |
182 INSERT INTO x2 VALUES(1), (2); | 182 INSERT INTO x2 VALUES(1), (2); |
183 SELECT count(*) FROM x2 WHERE b IN (SELECT DISTINCT a FROM x1 LIMIT 2); | 183 SELECT count(*) FROM x2 WHERE b IN (SELECT DISTINCT a FROM x1 LIMIT 2); |
184 } {2} | 184 } {2} |
185 | 185 |
| 186 #------------------------------------------------------------------------- |
| 187 # Test to confirm that bug [5e3c886796e5] is fixed. |
| 188 # |
| 189 do_execsql_test 7.1 { |
| 190 CREATE TABLE y1(a, b); |
| 191 CREATE TABLE y2(c); |
| 192 |
| 193 INSERT INTO y1 VALUES(1, 'one'); |
| 194 INSERT INTO y1 VALUES('two', 'two'); |
| 195 INSERT INTO y1 VALUES(3, 'three'); |
| 196 |
| 197 INSERT INTO y2 VALUES('one'); |
| 198 INSERT INTO y2 VALUES('two'); |
| 199 INSERT INTO y2 VALUES('three'); |
| 200 } {} |
| 201 |
| 202 do_execsql_test 7.2.1 { |
| 203 SELECT a FROM y1 WHERE b NOT IN (SELECT a FROM y2); |
| 204 } {1 3} |
| 205 do_execsql_test 7.2.2 { |
| 206 SELECT a FROM y1 WHERE b IN (SELECT a FROM y2); |
| 207 } {two} |
| 208 |
| 209 do_execsql_test 7.3.1 { |
| 210 CREATE INDEX y2c ON y2(c); |
| 211 SELECT a FROM y1 WHERE b NOT IN (SELECT a FROM y2); |
| 212 } {1 3} |
| 213 do_execsql_test 7.3.2 { |
| 214 SELECT a FROM y1 WHERE b IN (SELECT a FROM y2); |
| 215 } {two} |
| 216 |
| 217 #------------------------------------------------------------------------- |
| 218 # Tests to confirm that indexes on the rowid column do not confuse |
| 219 # the query planner. See ticket [0eab1ac7591f511d]. |
| 220 # |
| 221 do_execsql_test 8.0 { |
| 222 CREATE TABLE n1(a INTEGER PRIMARY KEY, b VARCHAR(500)); |
| 223 CREATE UNIQUE INDEX n1a ON n1(a); |
| 224 } |
| 225 |
| 226 do_execsql_test 8.1 { |
| 227 SELECT count(*) FROM n1 WHERE a IN (1, 2, 3) |
| 228 } 0 |
| 229 do_execsql_test 8.2 { |
| 230 SELECT count(*) FROM n1 WHERE a IN (SELECT +a FROM n1) |
| 231 } 0 |
| 232 do_execsql_test 8.3 { |
| 233 INSERT INTO n1 VALUES(1, NULL), (2, NULL), (3, NULL); |
| 234 SELECT count(*) FROM n1 WHERE a IN (1, 2, 3) |
| 235 } 3 |
| 236 do_execsql_test 8.4 { |
| 237 SELECT count(*) FROM n1 WHERE a IN (SELECT +a FROM n1) |
| 238 } 3 |
| 239 |
186 finish_test | 240 finish_test |
OLD | NEW |