Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: third_party/sqlite/src/test/select4.test

Issue 1610963002: Import SQLite 3.10.2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/sqlite/src/test/select1.test ('k') | third_party/sqlite/src/test/select6.test » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 ifcapable subquery { 98 ifcapable subquery {
99 do_test select4-1.2 { 99 do_test select4-1.2 {
100 execsql { 100 execsql {
101 SELECT log FROM t1 WHERE n IN 101 SELECT log FROM t1 WHERE n IN
102 (SELECT DISTINCT log FROM t1 UNION ALL 102 (SELECT DISTINCT log FROM t1 UNION ALL
103 SELECT n FROM t1 WHERE log=3) 103 SELECT n FROM t1 WHERE log=3)
104 ORDER BY log; 104 ORDER BY log;
105 } 105 }
106 } {0 1 2 2 3 3 3 3} 106 } {0 1 2 2 3 3 3 3}
107 } 107 }
108
109 # EVIDENCE-OF: R-02644-22131 In a compound SELECT statement, only the
110 # last or right-most simple SELECT may have an ORDER BY clause.
111 #
108 do_test select4-1.3 { 112 do_test select4-1.3 {
109 set v [catch {execsql { 113 set v [catch {execsql {
110 SELECT DISTINCT log FROM t1 ORDER BY log 114 SELECT DISTINCT log FROM t1 ORDER BY log
111 UNION ALL 115 UNION ALL
112 SELECT n FROM t1 WHERE log=3 116 SELECT n FROM t1 WHERE log=3
113 ORDER BY log; 117 ORDER BY log;
114 }} msg] 118 }} msg]
115 lappend v $msg 119 lappend v $msg
116 } {1 {ORDER BY clause should come after UNION ALL not before}} 120 } {1 {ORDER BY clause should come after UNION ALL not before}}
121 do_catchsql_test select4-1.4 {
122 SELECT (VALUES(0) INTERSECT SELECT(0) UNION SELECT(0) ORDER BY 1 UNION
123 SELECT 0 UNION SELECT 0 ORDER BY 1);
124 } {1 {ORDER BY clause should come after UNION not before}}
117 125
118 # Union operator 126 # Union operator
119 # 127 #
120 do_test select4-2.1 { 128 do_test select4-2.1 {
121 execsql { 129 execsql {
122 SELECT DISTINCT log FROM t1 130 SELECT DISTINCT log FROM t1
123 UNION 131 UNION
124 SELECT n FROM t1 WHERE log=3 132 SELECT n FROM t1 WHERE log=3
125 ORDER BY log; 133 ORDER BY log;
126 } 134 }
(...skipping 10 matching lines...) Expand all
137 } 145 }
138 do_test select4-2.3 { 146 do_test select4-2.3 {
139 set v [catch {execsql { 147 set v [catch {execsql {
140 SELECT DISTINCT log FROM t1 ORDER BY log 148 SELECT DISTINCT log FROM t1 ORDER BY log
141 UNION 149 UNION
142 SELECT n FROM t1 WHERE log=3 150 SELECT n FROM t1 WHERE log=3
143 ORDER BY log; 151 ORDER BY log;
144 }} msg] 152 }} msg]
145 lappend v $msg 153 lappend v $msg
146 } {1 {ORDER BY clause should come after UNION not before}} 154 } {1 {ORDER BY clause should come after UNION not before}}
155 do_test select4-2.4 {
156 set v [catch {execsql {
157 SELECT 0 ORDER BY (SELECT 0) UNION SELECT 0;
158 }} msg]
159 lappend v $msg
160 } {1 {ORDER BY clause should come after UNION not before}}
161 do_execsql_test select4-2.5 {
162 SELECT 123 AS x ORDER BY (SELECT x ORDER BY 1);
163 } {123}
147 164
148 # Except operator 165 # Except operator
149 # 166 #
150 do_test select4-3.1.1 { 167 do_test select4-3.1.1 {
151 execsql { 168 execsql {
152 SELECT DISTINCT log FROM t1 169 SELECT DISTINCT log FROM t1
153 EXCEPT 170 EXCEPT
154 SELECT n FROM t1 WHERE log=3 171 SELECT n FROM t1 WHERE log=3
155 ORDER BY log; 172 ORDER BY log;
156 } 173 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 } 270 }
254 do_test select4-4.3 { 271 do_test select4-4.3 {
255 set v [catch {execsql { 272 set v [catch {execsql {
256 SELECT DISTINCT log FROM t1 ORDER BY log 273 SELECT DISTINCT log FROM t1 ORDER BY log
257 INTERSECT 274 INTERSECT
258 SELECT n FROM t1 WHERE log=3 275 SELECT n FROM t1 WHERE log=3
259 ORDER BY log; 276 ORDER BY log;
260 }} msg] 277 }} msg]
261 lappend v $msg 278 lappend v $msg
262 } {1 {ORDER BY clause should come after INTERSECT not before}} 279 } {1 {ORDER BY clause should come after INTERSECT not before}}
280 do_catchsql_test select4-4.4 {
281 SELECT 3 IN (
282 SELECT 0 ORDER BY 1
283 INTERSECT
284 SELECT 1
285 INTERSECT
286 SELECT 2
287 ORDER BY 1
288 );
289 } {1 {ORDER BY clause should come after INTERSECT not before}}
263 290
264 # Various error messages while processing UNION or INTERSECT 291 # Various error messages while processing UNION or INTERSECT
265 # 292 #
266 do_test select4-5.1 { 293 do_test select4-5.1 {
267 set v [catch {execsql { 294 set v [catch {execsql {
268 SELECT DISTINCT log FROM t2 295 SELECT DISTINCT log FROM t2
269 UNION ALL 296 UNION ALL
270 SELECT n FROM t1 WHERE log=3 297 SELECT n FROM t1 WHERE log=3
271 ORDER BY log; 298 ORDER BY log;
272 }} msg] 299 }} msg]
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 UNION 815 UNION
789 SELECT x FROM t2 816 SELECT x FROM t2
790 INTERSECT 817 INTERSECT
791 SELECT x FROM t2 818 SELECT x FROM t2
792 UNION ALL 819 UNION ALL
793 SELECT x FROM t2 820 SELECT x FROM t2
794 EXCEPT 821 EXCEPT
795 SELECT x FROM t2 822 SELECT x FROM t2
796 } 823 }
797 } {1 {SELECTs to the left and right of UNION do not have the same number of resu lt columns}} 824 } {1 {SELECTs to the left and right of UNION do not have the same number of resu lt columns}}
825 do_test select4-11.16 {
826 catchsql {
827 INSERT INTO t2(rowid) VALUES(2) UNION SELECT 3,4 UNION SELECT 5,6 ORDER BY 1 ;
828 }
829 } {1 {SELECTs to the left and right of UNION do not have the same number of resu lt columns}}
798 830
799 do_test select4-12.1 { 831 do_test select4-12.1 {
800 sqlite3 db2 :memory: 832 sqlite3 db2 :memory:
801 catchsql { 833 catchsql {
802 SELECT 1 UNION SELECT 2,3 UNION SELECT 4,5 ORDER BY 1; 834 SELECT 1 UNION SELECT 2,3 UNION SELECT 4,5 ORDER BY 1;
803 } db2 835 } db2
804 } {1 {SELECTs to the left and right of UNION do not have the same number of resu lt columns}} 836 } {1 {SELECTs to the left and right of UNION do not have the same number of resu lt columns}}
805 837
806 } ;# ifcapable compound 838 } ;# ifcapable compound
807 839
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 } {4 5 6} 884 } {4 5 6}
853 do_execsql_test select4-14.7 { 885 do_execsql_test select4-14.7 {
854 SELECT * FROM t14 EXCEPT VALUES(1,2,3) EXCEPT VALUES(4,5,6) 886 SELECT * FROM t14 EXCEPT VALUES(1,2,3) EXCEPT VALUES(4,5,6)
855 } {} 887 } {}
856 do_execsql_test select4-14.8 { 888 do_execsql_test select4-14.8 {
857 SELECT * FROM t14 EXCEPT VALUES('a','b','c') EXCEPT VALUES(4,5,6) 889 SELECT * FROM t14 EXCEPT VALUES('a','b','c') EXCEPT VALUES(4,5,6)
858 } {1 2 3} 890 } {1 2 3}
859 do_execsql_test select4-14.9 { 891 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); 892 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} 893 } {1 2 3 4 5 6 3 2 1 2 3 1 1 2 3 2 1 3}
894 do_execsql_test select4-14.10 {
895 SELECT (VALUES(1),(2),(3),(4))
896 } {1}
897 do_execsql_test select4-14.11 {
898 SELECT (SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4)
899 } {1}
900 do_execsql_test select4-14.12 {
901 VALUES(1) UNION VALUES(2);
902 } {1 2}
903 do_execsql_test select4-14.13 {
904 VALUES(1),(2),(3) EXCEPT VALUES(2);
905 } {1 3}
906 do_execsql_test select4-14.14 {
907 VALUES(1),(2),(3) EXCEPT VALUES(1),(3);
908 } {2}
909 do_execsql_test select4-14.15 {
910 SELECT * FROM (SELECT 123), (SELECT 456) ON likely(0 OR 1) OR 0;
911 } {123 456}
912 do_execsql_test select4-14.16 {
913 VALUES(1),(2),(3),(4) UNION ALL SELECT 5 LIMIT 99;
914 } {1 2 3 4 5}
915 do_execsql_test select4-14.17 {
916 VALUES(1),(2),(3),(4) UNION ALL SELECT 5 LIMIT 3;
917 } {1 2 3}
862 918
863 finish_test 919 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/select1.test ('k') | third_party/sqlite/src/test/select6.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698