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

Unified Diff: third_party/sqlite/src/test/select6.test

Issue 901033002: Import SQLite 3.8.7.4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Chromium changes to support SQLite 3.8.7.4. Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: third_party/sqlite/src/test/select6.test
diff --git a/third_party/sqlite/src/test/select6.test b/third_party/sqlite/src/test/select6.test
index e0ff165c550e7b3fcb80eaeaddb8116b290970f1..64a8519d890e46712a54bf7ff3bcc90c9a7bfeca 100644
--- a/third_party/sqlite/src/test/select6.test
+++ b/third_party/sqlite/src/test/select6.test
@@ -22,6 +22,7 @@ ifcapable !subquery {
finish_test
return
}
+set ::testprefix select6
do_test select6-1.0 {
execsql {
@@ -513,5 +514,48 @@ do_test select6-9.11 {
} {2 12 3 13 4 14}
+#-------------------------------------------------------------------------
+# Test that if a UNION ALL sub-query that would otherwise be eligible for
+# flattening consists of two or more SELECT statements that do not all
+# return the same number of result columns, the error is detected.
+#
+do_execsql_test 10.1 {
+ CREATE TABLE t(i,j,k);
+ CREATE TABLE j(l,m);
+ CREATE TABLE k(o);
+}
+
+set err [list 1 {SELECTs to the left and right of UNION ALL do not have the same number of result columns}]
+
+do_execsql_test 10.2 {
+ SELECT * FROM (SELECT * FROM t), j;
+}
+do_catchsql_test 10.3 {
+ SELECT * FROM t UNION ALL SELECT * FROM j
+} $err
+do_catchsql_test 10.4 {
+ SELECT * FROM (SELECT i FROM t UNION ALL SELECT l, m FROM j)
+} $err
+do_catchsql_test 10.5 {
+ SELECT * FROM (SELECT j FROM t UNION ALL SELECT * FROM j)
+} $err
+do_catchsql_test 10.6 {
+ SELECT * FROM (SELECT * FROM t UNION ALL SELECT * FROM j)
+} $err
+do_catchsql_test 10.7 {
+ SELECT * FROM (
+ SELECT * FROM t UNION ALL
+ SELECT l,m,l FROM j UNION ALL
+ SELECT * FROM k
+ )
+} $err
+do_catchsql_test 10.8 {
+ SELECT * FROM (
+ SELECT * FROM k UNION ALL
+ SELECT * FROM t UNION ALL
+ SELECT l,m,l FROM j
+ )
+} $err
+
finish_test

Powered by Google App Engine
This is Rietveld 408576698