| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 catchsql { | 131 catchsql { |
| 132 SELECT 5 IN (SELECT * FROM t2 UNION SELECT * FROM t2); | 132 SELECT 5 IN (SELECT * FROM t2 UNION SELECT * FROM t2); |
| 133 } | 133 } |
| 134 } [list 1 \ | 134 } [list 1 \ |
| 135 {only a single result allowed for a SELECT that is part of an expression}] | 135 {only a single result allowed for a SELECT that is part of an expression}] |
| 136 } | 136 } |
| 137 | 137 |
| 138 # Verify that an error occurs if you have too many terms on a | 138 # Verify that an error occurs if you have too many terms on a |
| 139 # compound select statement. | 139 # compound select statement. |
| 140 # | 140 # |
| 141 ifcapable compound { | 141 if {[clang_sanitize_address]==0} { |
| 142 if {$SQLITE_MAX_COMPOUND_SELECT>0} { | 142 ifcapable compound { |
| 143 set sql {SELECT 0} | 143 if {$SQLITE_MAX_COMPOUND_SELECT>0} { |
| 144 set result 0 | 144 set sql {SELECT 0} |
| 145 for {set i 1} {$i<$SQLITE_MAX_COMPOUND_SELECT} {incr i} { | 145 set result 0 |
| 146 append sql " UNION ALL SELECT $i" | 146 for {set i 1} {$i<$SQLITE_MAX_COMPOUND_SELECT} {incr i} { |
| 147 lappend result $i | 147 append sql " UNION ALL SELECT $i" |
| 148 lappend result $i |
| 149 } |
| 150 do_test select7-6.1 { |
| 151 catchsql $sql |
| 152 } [list 0 $result] |
| 153 append sql { UNION ALL SELECT 99999999} |
| 154 do_test select7-6.2 { |
| 155 catchsql $sql |
| 156 } {1 {too many terms in compound SELECT}} |
| 148 } | 157 } |
| 149 do_test select7-6.1 { | |
| 150 catchsql $sql | |
| 151 } [list 0 $result] | |
| 152 append sql { UNION ALL SELECT 99999999} | |
| 153 do_test select7-6.2 { | |
| 154 catchsql $sql | |
| 155 } {1 {too many terms in compound SELECT}} | |
| 156 } | 158 } |
| 157 } | 159 } |
| 158 | 160 |
| 159 # This block of tests verifies that bug aa92c76cd4 is fixed. | 161 # This block of tests verifies that bug aa92c76cd4 is fixed. |
| 160 # | 162 # |
| 161 do_test select7-7.1 { | 163 do_test select7-7.1 { |
| 162 execsql { | 164 execsql { |
| 163 CREATE TABLE t3(a REAL); | 165 CREATE TABLE t3(a REAL); |
| 164 INSERT INTO t3 VALUES(44.0); | 166 INSERT INTO t3 VALUES(44.0); |
| 165 INSERT INTO t3 VALUES(56.0); | 167 INSERT INTO t3 VALUES(56.0); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 193 | 195 |
| 194 do_test select7-7.7 { | 196 do_test select7-7.7 { |
| 195 execsql { | 197 execsql { |
| 196 CREATE TABLE t5(a TEXT, b INT); | 198 CREATE TABLE t5(a TEXT, b INT); |
| 197 INSERT INTO t5 VALUES(123, 456); | 199 INSERT INTO t5 VALUES(123, 456); |
| 198 SELECT typeof(a), a FROM t5 GROUP BY a HAVING a<b; | 200 SELECT typeof(a), a FROM t5 GROUP BY a HAVING a<b; |
| 199 } | 201 } |
| 200 } {text 123} | 202 } {text 123} |
| 201 | 203 |
| 202 finish_test | 204 finish_test |
| OLD | NEW |