| OLD | NEW |
| 1 # The author disclaims copyright to this source code. In place of | 1 # The author disclaims copyright to this source code. In place of |
| 2 # a legal notice, here is a blessing: | 2 # a legal notice, here is a blessing: |
| 3 # | 3 # |
| 4 # May you do good and not evil. | 4 # May you do good and not evil. |
| 5 # May you find forgiveness for yourself and forgive others. | 5 # May you find forgiveness for yourself and forgive others. |
| 6 # May you share freely, never taking more than you give. | 6 # May you share freely, never taking more than you give. |
| 7 # | 7 # |
| 8 #*********************************************************************** | 8 #*********************************************************************** |
| 9 # This file implements regression tests for SQLite library. The | 9 # This file implements regression tests for SQLite library. The |
| 10 # focus of this file is testing compute SELECT statements and nested | 10 # focus of this file is testing compute SELECT statements and nested |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 } | 107 } |
| 108 | 108 |
| 109 # ticket #2347 | 109 # ticket #2347 |
| 110 # | 110 # |
| 111 ifcapable {subquery && compound} { | 111 ifcapable {subquery && compound} { |
| 112 do_test select7-5.1 { | 112 do_test select7-5.1 { |
| 113 catchsql { | 113 catchsql { |
| 114 CREATE TABLE t2(a,b); | 114 CREATE TABLE t2(a,b); |
| 115 SELECT 5 IN (SELECT a,b FROM t2); | 115 SELECT 5 IN (SELECT a,b FROM t2); |
| 116 } | 116 } |
| 117 } [list 1 \ | 117 } {1 {sub-select returns 2 columns - expected 1}} |
| 118 {only a single result allowed for a SELECT that is part of an expression}] | |
| 119 do_test select7-5.2 { | 118 do_test select7-5.2 { |
| 120 catchsql { | 119 catchsql { |
| 121 SELECT 5 IN (SELECT * FROM t2); | 120 SELECT 5 IN (SELECT * FROM t2); |
| 122 } | 121 } |
| 123 } [list 1 \ | 122 } {1 {sub-select returns 2 columns - expected 1}} |
| 124 {only a single result allowed for a SELECT that is part of an expression}] | |
| 125 do_test select7-5.3 { | 123 do_test select7-5.3 { |
| 126 catchsql { | 124 catchsql { |
| 127 SELECT 5 IN (SELECT a,b FROM t2 UNION SELECT b,a FROM t2); | 125 SELECT 5 IN (SELECT a,b FROM t2 UNION SELECT b,a FROM t2); |
| 128 } | 126 } |
| 129 } [list 1 \ | 127 } {1 {sub-select returns 2 columns - expected 1}} |
| 130 {only a single result allowed for a SELECT that is part of an expression}] | |
| 131 do_test select7-5.4 { | 128 do_test select7-5.4 { |
| 132 catchsql { | 129 catchsql { |
| 133 SELECT 5 IN (SELECT * FROM t2 UNION SELECT * FROM t2); | 130 SELECT 5 IN (SELECT * FROM t2 UNION SELECT * FROM t2); |
| 134 } | 131 } |
| 135 } [list 1 \ | 132 } {1 {sub-select returns 2 columns - expected 1}} |
| 136 {only a single result allowed for a SELECT that is part of an expression}] | |
| 137 } | 133 } |
| 138 | 134 |
| 139 # Verify that an error occurs if you have too many terms on a | 135 # Verify that an error occurs if you have too many terms on a |
| 140 # compound select statement. | 136 # compound select statement. |
| 141 # | 137 # |
| 142 if {[clang_sanitize_address]==0} { | 138 if {[clang_sanitize_address]==0} { |
| 143 ifcapable compound { | 139 ifcapable compound { |
| 144 if {$SQLITE_MAX_COMPOUND_SELECT>0} { | 140 if {$SQLITE_MAX_COMPOUND_SELECT>0} { |
| 145 set sql {SELECT 0} | 141 set sql {SELECT 0} |
| 146 set result 0 | 142 set result 0 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 ) WHERE y=1 | 209 ) WHERE y=1 |
| 214 } {1 {SELECTs to the left and right of UNION do not have the same number of resu
lt columns}} | 210 } {1 {SELECTs to the left and right of UNION do not have the same number of resu
lt columns}} |
| 215 | 211 |
| 216 do_catchsql_test 8.2 { | 212 do_catchsql_test 8.2 { |
| 217 CREATE VIEW v0 as SELECT x, y FROM t01 UNION SELECT x FROM t02; | 213 CREATE VIEW v0 as SELECT x, y FROM t01 UNION SELECT x FROM t02; |
| 218 EXPLAIN QUERY PLAN SELECT * FROM v0 WHERE x='0' OR y; | 214 EXPLAIN QUERY PLAN SELECT * FROM v0 WHERE x='0' OR y; |
| 219 } {1 {SELECTs to the left and right of UNION do not have the same number of resu
lt columns}} | 215 } {1 {SELECTs to the left and right of UNION do not have the same number of resu
lt columns}} |
| 220 | 216 |
| 221 | 217 |
| 222 finish_test | 218 finish_test |
| 223 | |
| 224 | |
| OLD | NEW |