1 # 2008 October 25 2 # 3 # The author disclaims copyright to this source code. In place of 4 # a legal notice, here is a blessing: 5 # 6 # May you do good and not evil. 7 # May you find forgiveness for yourself and forgive others. 8 # May you share freely, never taking more than you give. 9 # 10 #*********************************************************************** 11 # This file implements regression tests for SQLite library. 12 # 13 # This file implements tests to verify that ticket #3461 has been 14 # fixed. 15 # 16 # $Id: tkt3461.test,v 1.4 2009/06/05 17:09:12 drh Exp $ 17 18 set testdir [file dirname $argv0] 19 source $testdir/tester.tcl 20 21 #################################### 22 #################################### 23 # REMOVE THESE TWO LINES: 24 #################################### 25 #################################### 26 #finish_test 27 #return 28 29 do_test tkt3461-1.1 { 30 execsql { 31 CREATE TABLE t1(a, b); 32 INSERT INTO t1 VALUES(1, 2); 33 } 34 } {} 35 36 do_test tkt3461-1.2 { 37 execsql { SELECT a, b+1 AS b_plus_one FROM t1 WHERE a=1 } 38 } {1 3} 39 40 do_test tkt3461-1.3 { 41 # explain { SELECT a, b+1 AS b_plus_one FROM t1 WHERE a=1 OR b_plus_one } 42 # execsql { PRAGMA vdbe_trace = 1; PRAGMA vdbe_listing=1 } 43 execsql { SELECT a, b+1 AS b_plus_one FROM t1 WHERE a=1 OR b_plus_one } 44 } {1 3} 45 46 do_test tkt3461-2.1 { 47 execsql { 48 SELECT a, b+1 AS b_plus_one 49 FROM t1 50 WHERE CASE WHEN a=1 THEN 1 ELSE b_plus_one END 51 } 52 } {1 3} 53 54 do_test tkt3461-3.1 { 55 execsql { 56 CREATE TABLE t2(c, d); 57 INSERT INTO t2 VALUES(3, 4); 58 } 59 # execsql { PRAGMA vdbe_trace = 1; PRAGMA vdbe_listing=1 } 60 execsql { 61 SELECT a, b+1 AS b_plus_one, c, d 62 FROM t1 LEFT JOIN t2 63 ON (a=c AND d=b_plus_one) 64 } 65 } {1 3 {} {}} 66 67 finish_test 68