OLD | NEW |
1 # 2001 September 15 | 1 # 2001 September 15 |
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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 do_test in-7.4 { | 251 do_test in-7.4 { |
252 execsql { | 252 execsql { |
253 SELECT a FROM t1 WHERE a IN (5) AND b IN (); | 253 SELECT a FROM t1 WHERE a IN (5) AND b IN (); |
254 } | 254 } |
255 } {} | 255 } {} |
256 do_test in-7.5 { | 256 do_test in-7.5 { |
257 execsql { | 257 execsql { |
258 SELECT a FROM t1 WHERE a IN (5) AND b NOT IN (); | 258 SELECT a FROM t1 WHERE a IN (5) AND b NOT IN (); |
259 } | 259 } |
260 } {5} | 260 } {5} |
261 do_test in-7.6 { | 261 do_test in-7.6.1 { |
262 execsql { | 262 execsql { |
263 SELECT a FROM ta WHERE a IN (); | 263 SELECT a FROM ta WHERE a IN (); |
264 } | 264 } |
265 } {} | 265 } {} |
| 266 do_test in-7.6.2 { |
| 267 db status step |
| 268 } {0} |
266 do_test in-7.7 { | 269 do_test in-7.7 { |
267 execsql { | 270 execsql { |
268 SELECT a FROM ta WHERE a NOT IN (); | 271 SELECT a FROM ta WHERE a NOT IN (); |
269 } | 272 } |
270 } {1 2 3 4 6 8 10} | 273 } {1 2 3 4 6 8 10} |
271 | 274 |
| 275 do_test in-7.8.1 { |
| 276 execsql { |
| 277 SELECT * FROM ta LEFT JOIN tb ON (ta.b=tb.b) WHERE ta.a IN (); |
| 278 } |
| 279 } {} |
| 280 do_test in-7.8.2 { |
| 281 db status step |
| 282 } {0} |
| 283 |
272 do_test in-8.1 { | 284 do_test in-8.1 { |
273 execsql { | 285 execsql { |
274 SELECT b FROM t1 WHERE a IN ('hello','there') | 286 SELECT b FROM t1 WHERE a IN ('hello','there') |
275 } | 287 } |
276 } {world} | 288 } {world} |
277 do_test in-8.2 { | 289 do_test in-8.2 { |
278 execsql { | 290 execsql { |
279 SELECT b FROM t1 WHERE a IN ("hello",'there') | 291 SELECT b FROM t1 WHERE a IN ("hello",'there') |
280 } | 292 } |
281 } {world} | 293 } {world} |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 CHECK( a IN (111,222,333) ) | 325 CHECK( a IN (111,222,333) ) |
314 ); | 326 ); |
315 INSERT INTO t5 VALUES(111); | 327 INSERT INTO t5 VALUES(111); |
316 SELECT * FROM t5; | 328 SELECT * FROM t5; |
317 } | 329 } |
318 } {111} | 330 } {111} |
319 do_test in-10.2 { | 331 do_test in-10.2 { |
320 catchsql { | 332 catchsql { |
321 INSERT INTO t5 VALUES(4); | 333 INSERT INTO t5 VALUES(4); |
322 } | 334 } |
323 } {1 {constraint failed}} | 335 } {1 {CHECK constraint failed: t5}} |
324 | 336 |
325 # Ticket #1821 | 337 # Ticket #1821 |
326 # | 338 # |
327 # Type affinity applied to the right-hand side of an IN operator. | 339 # Type affinity applied to the right-hand side of an IN operator. |
328 # | 340 # |
329 do_test in-11.1 { | 341 do_test in-11.1 { |
330 execsql { | 342 execsql { |
331 CREATE TABLE t6(a,b NUMERIC); | 343 CREATE TABLE t6(a,b NUMERIC); |
332 INSERT INTO t6 VALUES(1,2); | 344 INSERT INTO t6 VALUES(1,2); |
333 INSERT INTO t6 VALUES(2,3); | 345 INSERT INTO t6 VALUES(2,3); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 } {1 {SELECTs to the left and right of EXCEPT do not have the same number of res
ult columns}} | 436 } {1 {SELECTs to the left and right of EXCEPT do not have the same number of res
ult columns}} |
425 do_test in-12.9 { | 437 do_test in-12.9 { |
426 catchsql { | 438 catchsql { |
427 SELECT * FROM t2 WHERE a IN ( | 439 SELECT * FROM t2 WHERE a IN ( |
428 SELECT a, b FROM t3 INTERSECT SELECT a FROM t2 | 440 SELECT a, b FROM t3 INTERSECT SELECT a FROM t2 |
429 ); | 441 ); |
430 } | 442 } |
431 } {1 {SELECTs to the left and right of INTERSECT do not have the same number of
result columns}} | 443 } {1 {SELECTs to the left and right of INTERSECT do not have the same number of
result columns}} |
432 } | 444 } |
433 | 445 |
| 446 ifcapable compound { |
434 do_test in-12.10 { | 447 do_test in-12.10 { |
435 catchsql { | 448 catchsql { |
436 SELECT * FROM t2 WHERE a IN ( | 449 SELECT * FROM t2 WHERE a IN ( |
437 SELECT a FROM t3 UNION ALL SELECT a, b FROM t2 | 450 SELECT a FROM t3 UNION ALL SELECT a, b FROM t2 |
438 ); | 451 ); |
439 } | 452 } |
440 } {1 {only a single result allowed for a SELECT that is part of an expression}} | 453 } {1 {only a single result allowed for a SELECT that is part of an expression}} |
441 do_test in-12.11 { | 454 do_test in-12.11 { |
442 catchsql { | 455 catchsql { |
443 SELECT * FROM t2 WHERE a IN ( | 456 SELECT * FROM t2 WHERE a IN ( |
444 SELECT a FROM t3 UNION SELECT a, b FROM t2 | 457 SELECT a FROM t3 UNION SELECT a, b FROM t2 |
445 ); | 458 ); |
446 } | 459 } |
447 } {1 {only a single result allowed for a SELECT that is part of an expression}} | 460 } {1 {only a single result allowed for a SELECT that is part of an expression}} |
448 do_test in-12.12 { | 461 do_test in-12.12 { |
449 catchsql { | 462 catchsql { |
450 SELECT * FROM t2 WHERE a IN ( | 463 SELECT * FROM t2 WHERE a IN ( |
451 SELECT a FROM t3 EXCEPT SELECT a, b FROM t2 | 464 SELECT a FROM t3 EXCEPT SELECT a, b FROM t2 |
452 ); | 465 ); |
453 } | 466 } |
454 } {1 {only a single result allowed for a SELECT that is part of an expression}} | 467 } {1 {only a single result allowed for a SELECT that is part of an expression}} |
455 do_test in-12.13 { | 468 do_test in-12.13 { |
456 catchsql { | 469 catchsql { |
457 SELECT * FROM t2 WHERE a IN ( | 470 SELECT * FROM t2 WHERE a IN ( |
458 SELECT a FROM t3 INTERSECT SELECT a, b FROM t2 | 471 SELECT a FROM t3 INTERSECT SELECT a, b FROM t2 |
459 ); | 472 ); |
460 } | 473 } |
461 } {1 {only a single result allowed for a SELECT that is part of an expression}} | 474 } {1 {only a single result allowed for a SELECT that is part of an expression}} |
| 475 }; #ifcapable compound |
462 | 476 |
463 | 477 |
464 #------------------------------------------------------------------------ | 478 #------------------------------------------------------------------------ |
465 # The following tests check that NULL is handled correctly when it | 479 # The following tests check that NULL is handled correctly when it |
466 # appears as part of a set of values on the right-hand side of an | 480 # appears as part of a set of values on the right-hand side of an |
467 # IN or NOT IN operator. | 481 # IN or NOT IN operator. |
468 # | 482 # |
469 # When it appears in such a set, NULL is handled as an "unknown value". | 483 # When it appears in such a set, NULL is handled as an "unknown value". |
470 # If, because of the unknown value in the set, the result of the expression | 484 # If, because of the unknown value in the set, the result of the expression |
471 # cannot be determined, then it itself evaluates to NULL. | 485 # cannot be determined, then it itself evaluates to NULL. |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 SELECT * FROM a WHERE id NOT IN (SELECT id FROM b); | 614 SELECT * FROM a WHERE id NOT IN (SELECT id FROM b); |
601 } | 615 } |
602 } {} | 616 } {} |
603 | 617 |
604 | 618 |
605 do_test in-13.X { | 619 do_test in-13.X { |
606 db nullvalue "" | 620 db nullvalue "" |
607 } {} | 621 } {} |
608 | 622 |
609 finish_test | 623 finish_test |
OLD | NEW |