| 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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 } {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}} |
| 444 } | 444 } |
| 445 | 445 |
| 446 ifcapable compound { | 446 ifcapable compound { |
| 447 do_test in-12.10 { | 447 do_test in-12.10 { |
| 448 catchsql { | 448 catchsql { |
| 449 SELECT * FROM t2 WHERE a IN ( | 449 SELECT * FROM t2 WHERE a IN ( |
| 450 SELECT a FROM t3 UNION ALL SELECT a, b FROM t2 | 450 SELECT a FROM t3 UNION ALL SELECT a, b FROM t2 |
| 451 ); | 451 ); |
| 452 } | 452 } |
| 453 } {1 {only a single result allowed for a SELECT that is part of an expression}} | 453 } {1 {SELECTs to the left and right of UNION ALL do not have the same number of
result columns}} |
| 454 do_test in-12.11 { | 454 do_test in-12.11 { |
| 455 catchsql { | 455 catchsql { |
| 456 SELECT * FROM t2 WHERE a IN ( | 456 SELECT * FROM t2 WHERE a IN ( |
| 457 SELECT a FROM t3 UNION SELECT a, b FROM t2 | 457 SELECT a FROM t3 UNION SELECT a, b FROM t2 |
| 458 ); | 458 ); |
| 459 } | 459 } |
| 460 } {1 {only a single result allowed for a SELECT that is part of an expression}} | 460 } {1 {SELECTs to the left and right of UNION do not have the same number of resu
lt columns}} |
| 461 do_test in-12.12 { | 461 do_test in-12.12 { |
| 462 catchsql { | 462 catchsql { |
| 463 SELECT * FROM t2 WHERE a IN ( | 463 SELECT * FROM t2 WHERE a IN ( |
| 464 SELECT a FROM t3 EXCEPT SELECT a, b FROM t2 | 464 SELECT a FROM t3 EXCEPT SELECT a, b FROM t2 |
| 465 ); | 465 ); |
| 466 } | 466 } |
| 467 } {1 {only a single result allowed for a SELECT that is part of an expression}} | 467 } {1 {SELECTs to the left and right of EXCEPT do not have the same number of res
ult columns}} |
| 468 do_test in-12.13 { | 468 do_test in-12.13 { |
| 469 catchsql { | 469 catchsql { |
| 470 SELECT * FROM t2 WHERE a IN ( | 470 SELECT * FROM t2 WHERE a IN ( |
| 471 SELECT a FROM t3 INTERSECT SELECT a, b FROM t2 | 471 SELECT a FROM t3 INTERSECT SELECT a, b FROM t2 |
| 472 ); | 472 ); |
| 473 } | 473 } |
| 474 } {1 {SELECTs to the left and right of INTERSECT do not have the same number of
result columns}} |
| 475 do_test in-12.14 { |
| 476 catchsql { |
| 477 SELECT * FROM t2 WHERE a IN ( |
| 478 SELECT a, b FROM t3 UNION ALL SELECT a, b FROM t2 |
| 479 ); |
| 480 } |
| 474 } {1 {only a single result allowed for a SELECT that is part of an expression}} | 481 } {1 {only a single result allowed for a SELECT that is part of an expression}} |
| 482 do_test in-12.15 { |
| 483 catchsql { |
| 484 SELECT * FROM t2 WHERE a IN ( |
| 485 SELECT a, b FROM t3 UNION ALL SELECT a FROM t2 |
| 486 ); |
| 487 } |
| 488 } {1 {SELECTs to the left and right of UNION ALL do not have the same number of
result columns}} |
| 475 }; #ifcapable compound | 489 }; #ifcapable compound |
| 476 | 490 |
| 477 | 491 |
| 478 #------------------------------------------------------------------------ | 492 #------------------------------------------------------------------------ |
| 479 # The following tests check that NULL is handled correctly when it | 493 # The following tests check that NULL is handled correctly when it |
| 480 # appears as part of a set of values on the right-hand side of an | 494 # appears as part of a set of values on the right-hand side of an |
| 481 # IN or NOT IN operator. | 495 # IN or NOT IN operator. |
| 482 # | 496 # |
| 483 # When it appears in such a set, NULL is handled as an "unknown value". | 497 # When it appears in such a set, NULL is handled as an "unknown value". |
| 484 # If, because of the unknown value in the set, the result of the expression | 498 # If, because of the unknown value in the set, the result of the expression |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 SELECT * FROM a WHERE id NOT IN (SELECT id FROM b); | 622 SELECT * FROM a WHERE id NOT IN (SELECT id FROM b); |
| 609 } | 623 } |
| 610 } {} | 624 } {} |
| 611 do_test in-13.14 { | 625 do_test in-13.14 { |
| 612 execsql { | 626 execsql { |
| 613 CREATE INDEX i5 ON b(id); | 627 CREATE INDEX i5 ON b(id); |
| 614 SELECT * FROM a WHERE id NOT IN (SELECT id FROM b); | 628 SELECT * FROM a WHERE id NOT IN (SELECT id FROM b); |
| 615 } | 629 } |
| 616 } {} | 630 } {} |
| 617 | 631 |
| 632 do_test in-13.15 { |
| 633 catchsql { |
| 634 SELECT 0 WHERE (SELECT 0,0) OR (0 IN (1,2)); |
| 635 } |
| 636 } {1 {only a single result allowed for a SELECT that is part of an expression}} |
| 637 |
| 618 | 638 |
| 619 do_test in-13.X { | 639 do_test in-13.X { |
| 620 db nullvalue "" | 640 db nullvalue "" |
| 621 } {} | 641 } {} |
| 622 | 642 |
| 623 finish_test | 643 finish_test |
| OLD | NEW |