OLD | NEW |
1 # 2008 September 16 | 1 # 2008 September 16 |
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 #*********************************************************************** |
11 # This file implements regression tests for SQLite library. | 11 # This file implements regression tests for SQLite library. |
12 # | 12 # |
13 # $Id: selectC.test,v 1.5 2009/05/17 15:26:21 drh Exp $ | 13 # $Id: selectC.test,v 1.5 2009/05/17 15:26:21 drh Exp $ |
14 | 14 |
15 set testdir [file dirname $argv0] | 15 set testdir [file dirname $argv0] |
16 source $testdir/tester.tcl | 16 source $testdir/tester.tcl |
| 17 set testprefix selectC |
17 | 18 |
18 # Ticket # | 19 # Ticket # |
19 do_test selectC-1.1 { | 20 do_test selectC-1.1 { |
20 execsql { | 21 execsql { |
21 CREATE TABLE t1(a, b, c); | 22 CREATE TABLE t1(a, b, c); |
22 INSERT INTO t1 VALUES(1,'aaa','bbb'); | 23 INSERT INTO t1 VALUES(1,'aaa','bbb'); |
23 INSERT INTO t1 SELECT * FROM t1; | 24 INSERT INTO t1 SELECT * FROM t1; |
24 INSERT INTO t1 VALUES(2,'ccc','ddd'); | 25 INSERT INTO t1 VALUES(2,'ccc','ddd'); |
25 | 26 |
26 SELECT DISTINCT a AS x, b||c AS y | 27 SELECT DISTINCT a AS x, b||c AS y |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 } {} | 227 } {} |
227 | 228 |
228 do_execsql_test selectC-4.2 { | 229 do_execsql_test selectC-4.2 { |
229 select a from (select distinct a, b from t_distinct_bug) | 230 select a from (select distinct a, b from t_distinct_bug) |
230 } {1 1 1} | 231 } {1 1 1} |
231 | 232 |
232 do_execsql_test selectC-4.3 { | 233 do_execsql_test selectC-4.3 { |
233 select a, udf() from (select distinct a, b from t_distinct_bug) | 234 select a, udf() from (select distinct a, b from t_distinct_bug) |
234 } {1 1 1 2 1 3} | 235 } {1 1 1 2 1 3} |
235 | 236 |
| 237 #------------------------------------------------------------------------- |
| 238 # Test that the problem in ticket #190c2507 has been fixed. |
| 239 # |
| 240 do_execsql_test 5.0 { |
| 241 CREATE TABLE x1(a); |
| 242 CREATE TABLE x2(b); |
| 243 CREATE TABLE x3(c); |
| 244 CREATE VIEW vvv AS SELECT b FROM x2 ORDER BY 1; |
| 245 |
| 246 INSERT INTO x1 VALUES('a'), ('b'); |
| 247 INSERT INTO x2 VALUES(22), (23), (25), (24), (21); |
| 248 INSERT INTO x3 VALUES(302), (303), (301); |
| 249 } |
| 250 |
| 251 do_execsql_test 5.1 { |
| 252 CREATE TABLE x4 AS SELECT b FROM vvv UNION ALL SELECT c from x3; |
| 253 SELECT * FROM x4; |
| 254 } {21 22 23 24 25 302 303 301} |
| 255 |
| 256 do_execsql_test 5.2 { |
| 257 SELECT * FROM x1, x4 |
| 258 } { |
| 259 a 21 a 22 a 23 a 24 a 25 a 302 a 303 a 301 |
| 260 b 21 b 22 b 23 b 24 b 25 b 302 b 303 b 301 |
| 261 } |
| 262 |
| 263 do_execsql_test 5.3 { |
| 264 SELECT * FROM x1, (SELECT b FROM vvv UNION ALL SELECT c from x3); |
| 265 } { |
| 266 a 21 a 22 a 23 a 24 a 25 a 302 a 303 a 301 |
| 267 b 21 b 22 b 23 b 24 b 25 b 302 b 303 b 301 |
| 268 } |
| 269 |
236 finish_test | 270 finish_test |
OLD | NEW |