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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 } {32 128} | 307 } {32 128} |
308 do_test in-9.3 { | 308 do_test in-9.3 { |
309 execsql { | 309 execsql { |
310 SELECT b FROM t1 WHERE a NOT IN t4; | 310 SELECT b FROM t1 WHERE a NOT IN t4; |
311 } | 311 } |
312 } {64 256 world} | 312 } {64 256 world} |
313 do_test in-9.4 { | 313 do_test in-9.4 { |
314 catchsql { | 314 catchsql { |
315 SELECT b FROM t1 WHERE a NOT IN tb; | 315 SELECT b FROM t1 WHERE a NOT IN tb; |
316 } | 316 } |
317 } {1 {only a single result allowed for a SELECT that is part of an expression}} | 317 } {1 {sub-select returns 2 columns - expected 1}} |
318 | 318 |
319 # IN clauses in CHECK constraints. Ticket #1645 | 319 # IN clauses in CHECK constraints. Ticket #1645 |
320 # | 320 # |
321 do_test in-10.1 { | 321 do_test in-10.1 { |
322 execsql { | 322 execsql { |
323 CREATE TABLE t5( | 323 CREATE TABLE t5( |
324 a INTEGER, | 324 a INTEGER, |
325 CHECK( a IN (111,222,333) ) | 325 CHECK( a IN (111,222,333) ) |
326 ); | 326 ); |
327 INSERT INTO t5 VALUES(111); | 327 INSERT INTO t5 VALUES(111); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 CREATE TABLE t2(a, b, c); | 384 CREATE TABLE t2(a, b, c); |
385 CREATE TABLE t3(a, b, c); | 385 CREATE TABLE t3(a, b, c); |
386 } | 386 } |
387 } {} | 387 } {} |
388 do_test in-12.2 { | 388 do_test in-12.2 { |
389 catchsql { | 389 catchsql { |
390 SELECT * FROM t2 WHERE a IN ( | 390 SELECT * FROM t2 WHERE a IN ( |
391 SELECT a, b FROM t3 UNION ALL SELECT a, b FROM t2 | 391 SELECT a, b FROM t3 UNION ALL SELECT a, b FROM t2 |
392 ); | 392 ); |
393 } | 393 } |
394 } {1 {only a single result allowed for a SELECT that is part of an expression}} | 394 } {1 {sub-select returns 2 columns - expected 1}} |
395 do_test in-12.3 { | 395 do_test in-12.3 { |
396 catchsql { | 396 catchsql { |
397 SELECT * FROM t2 WHERE a IN ( | 397 SELECT * FROM t2 WHERE a IN ( |
398 SELECT a, b FROM t3 UNION SELECT a, b FROM t2 | 398 SELECT a, b FROM t3 UNION SELECT a, b FROM t2 |
399 ); | 399 ); |
400 } | 400 } |
401 } {1 {only a single result allowed for a SELECT that is part of an expression}} | 401 } {1 {sub-select returns 2 columns - expected 1}} |
402 do_test in-12.4 { | 402 do_test in-12.4 { |
403 catchsql { | 403 catchsql { |
404 SELECT * FROM t2 WHERE a IN ( | 404 SELECT * FROM t2 WHERE a IN ( |
405 SELECT a, b FROM t3 EXCEPT SELECT a, b FROM t2 | 405 SELECT a, b FROM t3 EXCEPT SELECT a, b FROM t2 |
406 ); | 406 ); |
407 } | 407 } |
408 } {1 {only a single result allowed for a SELECT that is part of an expression}} | 408 } {1 {sub-select returns 2 columns - expected 1}} |
409 do_test in-12.5 { | 409 do_test in-12.5 { |
410 catchsql { | 410 catchsql { |
411 SELECT * FROM t2 WHERE a IN ( | 411 SELECT * FROM t2 WHERE a IN ( |
412 SELECT a, b FROM t3 INTERSECT SELECT a, b FROM t2 | 412 SELECT a, b FROM t3 INTERSECT SELECT a, b FROM t2 |
413 ); | 413 ); |
414 } | 414 } |
415 } {1 {only a single result allowed for a SELECT that is part of an expression}} | 415 } {1 {sub-select returns 2 columns - expected 1}} |
416 do_test in-12.6 { | 416 do_test in-12.6 { |
417 catchsql { | 417 catchsql { |
418 SELECT * FROM t2 WHERE a IN ( | 418 SELECT * FROM t2 WHERE a IN ( |
419 SELECT a, b FROM t3 UNION ALL SELECT a FROM t2 | 419 SELECT a, b FROM t3 UNION ALL SELECT a FROM t2 |
420 ); | 420 ); |
421 } | 421 } |
422 } {1 {SELECTs to the left and right of UNION ALL do not have the same number of
result columns}} | 422 } {1 {SELECTs to the left and right of UNION ALL do not have the same number of
result columns}} |
423 do_test in-12.7 { | 423 do_test in-12.7 { |
424 catchsql { | 424 catchsql { |
425 SELECT * FROM t2 WHERE a IN ( | 425 SELECT * FROM t2 WHERE a IN ( |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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}} | 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 { | 475 do_test in-12.14 { |
476 catchsql { | 476 catchsql { |
477 SELECT * FROM t2 WHERE a IN ( | 477 SELECT * FROM t2 WHERE a IN ( |
478 SELECT a, b FROM t3 UNION ALL SELECT a, b FROM t2 | 478 SELECT a, b FROM t3 UNION ALL SELECT a, b FROM t2 |
479 ); | 479 ); |
480 } | 480 } |
481 } {1 {only a single result allowed for a SELECT that is part of an expression}} | 481 } {1 {sub-select returns 2 columns - expected 1}} |
482 do_test in-12.15 { | 482 do_test in-12.15 { |
483 catchsql { | 483 catchsql { |
484 SELECT * FROM t2 WHERE a IN ( | 484 SELECT * FROM t2 WHERE a IN ( |
485 SELECT a, b FROM t3 UNION ALL SELECT a FROM t2 | 485 SELECT a, b FROM t3 UNION ALL SELECT a FROM t2 |
486 ); | 486 ); |
487 } | 487 } |
488 } {1 {SELECTs to the left and right of UNION ALL do not have the same number of
result columns}} | 488 } {1 {SELECTs to the left and right of UNION ALL do not have the same number of
result columns}} |
489 }; #ifcapable compound | 489 }; #ifcapable compound |
490 | 490 |
491 | 491 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 SELECT * FROM a WHERE id NOT IN (SELECT id FROM b); | 622 SELECT * FROM a WHERE id NOT IN (SELECT id FROM b); |
623 } | 623 } |
624 } {} | 624 } {} |
625 do_test in-13.14 { | 625 do_test in-13.14 { |
626 execsql { | 626 execsql { |
627 CREATE INDEX i5 ON b(id); | 627 CREATE INDEX i5 ON b(id); |
628 SELECT * FROM a WHERE id NOT IN (SELECT id FROM b); | 628 SELECT * FROM a WHERE id NOT IN (SELECT id FROM b); |
629 } | 629 } |
630 } {} | 630 } {} |
631 | 631 |
| 632 breakpoint |
632 do_test in-13.15 { | 633 do_test in-13.15 { |
633 catchsql { | 634 catchsql { |
634 SELECT 0 WHERE (SELECT 0,0) OR (0 IN (1,2)); | 635 SELECT 0 WHERE (SELECT 0,0) OR (0 IN (1,2)); |
635 } | 636 } |
636 } {1 {only a single result allowed for a SELECT that is part of an expression}} | 637 } {1 {sub-select returns 2 columns - expected 1}} |
637 | 638 |
638 | 639 |
639 do_test in-13.X { | 640 do_test in-13.X { |
640 db nullvalue "" | 641 db nullvalue "" |
641 } {} | 642 } {} |
642 | 643 |
| 644 # At one point the following was causing valgrind to report a "jump |
| 645 # depends on unitialized location" problem. |
| 646 # |
| 647 do_execsql_test in-14.0 { |
| 648 CREATE TABLE c1(a); |
| 649 INSERT INTO c1 VALUES(1), (2), (4), (3); |
| 650 } |
| 651 do_execsql_test in-14.1 { |
| 652 SELECT * FROM c1 WHERE a IN (SELECT a FROM c1) ORDER BY 1 |
| 653 } {1 2 3 4} |
| 654 |
643 finish_test | 655 finish_test |
OLD | NEW |