| 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 |
| 11 # views. | 11 # views. |
| 12 # | 12 # |
| 13 # $Id: select7.test,v 1.11 2007/09/12 17:01:45 danielk1977 Exp $ | 13 # $Id: select7.test,v 1.11 2007/09/12 17:01:45 danielk1977 Exp $ |
| 14 | 14 |
| 15 | 15 |
| 16 set testdir [file dirname $argv0] | 16 set testdir [file dirname $argv0] |
| 17 source $testdir/tester.tcl | 17 source $testdir/tester.tcl |
| 18 set testprefix select7 |
| 18 | 19 |
| 19 ifcapable compound { | 20 ifcapable compound { |
| 20 | 21 |
| 21 # A 3-way INTERSECT. Ticket #875 | 22 # A 3-way INTERSECT. Ticket #875 |
| 22 ifcapable tempdb { | 23 ifcapable tempdb { |
| 23 do_test select7-1.1 { | 24 do_test select7-1.1 { |
| 24 execsql { | 25 execsql { |
| 25 create temp table t1(x); | 26 create temp table t1(x); |
| 26 insert into t1 values('amx'); | 27 insert into t1 values('amx'); |
| 27 insert into t1 values('anx'); | 28 insert into t1 values('anx'); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 } {0 real 0 real} | 195 } {0 real 0 real} |
| 195 | 196 |
| 196 do_test select7-7.7 { | 197 do_test select7-7.7 { |
| 197 execsql { | 198 execsql { |
| 198 CREATE TABLE t5(a TEXT, b INT); | 199 CREATE TABLE t5(a TEXT, b INT); |
| 199 INSERT INTO t5 VALUES(123, 456); | 200 INSERT INTO t5 VALUES(123, 456); |
| 200 SELECT typeof(a), a FROM t5 GROUP BY a HAVING a<b; | 201 SELECT typeof(a), a FROM t5 GROUP BY a HAVING a<b; |
| 201 } | 202 } |
| 202 } {text 123} | 203 } {text 123} |
| 203 | 204 |
| 205 do_execsql_test 8.0 { |
| 206 CREATE TABLE t01(x, y); |
| 207 CREATE TABLE t02(x, y); |
| 208 } |
| 209 |
| 210 do_catchsql_test 8.1 { |
| 211 SELECT * FROM ( |
| 212 SELECT * FROM t01 UNION SELECT x FROM t02 |
| 213 ) WHERE y=1 |
| 214 } {1 {SELECTs to the left and right of UNION do not have the same number of resu
lt columns}} |
| 215 |
| 216 do_catchsql_test 8.2 { |
| 217 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; |
| 219 } {1 {SELECTs to the left and right of UNION do not have the same number of resu
lt columns}} |
| 220 |
| 221 |
| 204 finish_test | 222 finish_test |
| 223 |
| 224 |
| OLD | NEW |