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 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 | 798 |
799 do_test select4-12.1 { | 799 do_test select4-12.1 { |
800 sqlite3 db2 :memory: | 800 sqlite3 db2 :memory: |
801 catchsql { | 801 catchsql { |
802 SELECT 1 UNION SELECT 2,3 UNION SELECT 4,5 ORDER BY 1; | 802 SELECT 1 UNION SELECT 2,3 UNION SELECT 4,5 ORDER BY 1; |
803 } db2 | 803 } db2 |
804 } {1 {SELECTs to the left and right of UNION do not have the same number of resu
lt columns}} | 804 } {1 {SELECTs to the left and right of UNION do not have the same number of resu
lt columns}} |
805 | 805 |
806 } ;# ifcapable compound | 806 } ;# ifcapable compound |
807 | 807 |
| 808 |
| 809 # Ticket [3557ad65a076c] - Incorrect DISTINCT processing with an |
| 810 # indexed query using IN. |
| 811 # |
| 812 do_test select4-13.1 { |
| 813 sqlite3 db test.db |
| 814 db eval { |
| 815 CREATE TABLE t13(a,b); |
| 816 INSERT INTO t13 VALUES(1,1); |
| 817 INSERT INTO t13 VALUES(2,1); |
| 818 INSERT INTO t13 VALUES(3,1); |
| 819 INSERT INTO t13 VALUES(2,2); |
| 820 INSERT INTO t13 VALUES(3,2); |
| 821 INSERT INTO t13 VALUES(4,2); |
| 822 CREATE INDEX t13ab ON t13(a,b); |
| 823 SELECT DISTINCT b from t13 WHERE a IN (1,2,3); |
| 824 } |
| 825 } {1 2} |
| 826 |
| 827 # 2014-02-18: Make sure compound SELECTs work with VALUES clauses |
| 828 # |
| 829 do_execsql_test select4-14.1 { |
| 830 CREATE TABLE t14(a,b,c); |
| 831 INSERT INTO t14 VALUES(1,2,3),(4,5,6); |
| 832 SELECT * FROM t14 INTERSECT VALUES(3,2,1),(2,3,1),(1,2,3),(2,1,3); |
| 833 } {1 2 3} |
| 834 do_execsql_test select4-14.2 { |
| 835 SELECT * FROM t14 INTERSECT VALUES(1,2,3); |
| 836 } {1 2 3} |
| 837 do_execsql_test select4-14.3 { |
| 838 SELECT * FROM t14 |
| 839 UNION VALUES(3,2,1),(2,3,1),(1,2,3),(7,8,9),(4,5,6) |
| 840 UNION SELECT * FROM t14 ORDER BY 1, 2, 3 |
| 841 } {1 2 3 2 3 1 3 2 1 4 5 6 7 8 9} |
| 842 do_execsql_test select4-14.4 { |
| 843 SELECT * FROM t14 |
| 844 UNION VALUES(3,2,1) |
| 845 UNION SELECT * FROM t14 ORDER BY 1, 2, 3 |
| 846 } {1 2 3 3 2 1 4 5 6} |
| 847 do_execsql_test select4-14.5 { |
| 848 SELECT * FROM t14 EXCEPT VALUES(3,2,1),(2,3,1),(1,2,3),(2,1,3); |
| 849 } {4 5 6} |
| 850 do_execsql_test select4-14.6 { |
| 851 SELECT * FROM t14 EXCEPT VALUES(1,2,3) |
| 852 } {4 5 6} |
| 853 do_execsql_test select4-14.7 { |
| 854 SELECT * FROM t14 EXCEPT VALUES(1,2,3) EXCEPT VALUES(4,5,6) |
| 855 } {} |
| 856 do_execsql_test select4-14.8 { |
| 857 SELECT * FROM t14 EXCEPT VALUES('a','b','c') EXCEPT VALUES(4,5,6) |
| 858 } {1 2 3} |
| 859 do_execsql_test select4-14.9 { |
| 860 SELECT * FROM t14 UNION ALL VALUES(3,2,1),(2,3,1),(1,2,3),(2,1,3); |
| 861 } {1 2 3 4 5 6 3 2 1 2 3 1 1 2 3 2 1 3} |
| 862 |
808 finish_test | 863 finish_test |
OLD | NEW |