Home | History | Annotate | Download | only in test
      1 # 2009 May 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 #
     12 # Tests to verify ticket #3879 is fixed.
     13 #
     14 # $Id: tkt3879.test,v 1.2 2009/06/05 17:09:12 drh Exp $
     15 
     16 set testdir [file dirname $argv0]
     17 source $testdir/tester.tcl
     18 
     19 do_test tkt3879.1.1 {
     20   execsql {
     21     CREATE TABLE t1 (a PRIMARY KEY, b);
     22     INSERT INTO t1 VALUES ('w',  1);
     23     INSERT INTO t1 VALUES ('z', -1);
     24   
     25     CREATE TABLE t2 (m INTEGER PRIMARY KEY, n, a, p);
     26     INSERT INTO t2 VALUES (25, 13, 'w', 1);
     27     INSERT INTO t2 VALUES (26, 25, 'z', 153);
     28     INSERT INTO t2 VALUES (27, 25, 'z', 68);
     29 
     30     CREATE TABLE t3 (m);
     31     INSERT INTO t3 VALUES (25);
     32   }
     33 } {}
     34 
     35 do_test tkt3879.1.2 {
     36   execsql {
     37     SELECT 111, t1.b*123
     38     FROM t3, t2 AS j0, t2 AS j1, t1
     39     WHERE j0.m=t3.m AND t1.a=j0.a AND j1.n=j0.m;
     40   }
     41 } {111 123 111 123}
     42 
     43 do_test tkt3879.1.3 {
     44   execsql {
     45     SELECT 222, t1.b*123
     46     FROM t3, t2 AS j0, t2 AS j1, t1
     47     WHERE j0.m=t3.m AND t1.a=j0.a AND j1.n=j0.m
     48     ORDER BY t1.b;
     49   }
     50 } {222 123 222 123}
     51 
     52 finish_test
     53