Home | History | Annotate | Download | only in test
      1 # 2008 October 06
      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 # This file implements regression tests for SQLite library.  The
     13 # focus of this file is testing the fix for ticket #3419.
     14 # Ticket #3419 is really a duplication of #3408 and had already
     15 # been fixed by the time it was reported.  But it never hurts to
     16 # add new test cases.
     17 #
     18 # $Id: tkt3419.test,v 1.1 2008/10/06 15:31:13 drh Exp $
     19 
     20 set testdir [file dirname $argv0]
     21 source $testdir/tester.tcl
     22 
     23 do_test tkt3419-1.1 {
     24   execsql {
     25     create table a(id integer primary key);
     26     create table b(id integer primary key, a_id integer);
     27     create table c(id integer primary key, b_id integer);
     28   
     29     insert into a values (1);
     30     insert into a values (2);
     31   
     32     insert into b values (3, 1);
     33     insert into b values (4, 1);
     34     insert into b values (5, 1);
     35     insert into b values (6, 1);
     36     insert into b values (9, 2);
     37   
     38     insert into c values (4, 3);
     39     insert into c values (5, 5);
     40     insert into c values (6, 4);
     41     insert into c values (7, 6);
     42     insert into c values (8, 9);
     43   
     44     select * FROM a, b, c WHERE a.id=2 AND b.a_id = a.id AND b.id=c.b_id;
     45   }
     46 } {2 9 2 8 9}
     47 do_test tkt3419-1.2 {
     48   execsql {
     49     select * FROM a, c, b WHERE a.id=2 AND b.a_id = a.id AND b.id=c.b_id;
     50   }
     51 } {2 8 9 9 2}
     52 do_test tkt3419-1.3 {
     53   execsql {
     54     select * FROM b, a, c WHERE a.id=2 AND b.a_id = a.id AND b.id=c.b_id;
     55   }
     56 } {9 2 2 8 9}
     57 do_test tkt3419-1.4 {
     58   execsql {
     59     select * FROM b, c, a WHERE a.id=2 AND b.a_id = a.id AND b.id=c.b_id;
     60   }
     61 } {9 2 8 9 2}
     62 do_test tkt3419-1.5 {
     63   execsql {
     64     select * FROM c, a, b WHERE a.id=2 AND b.a_id = a.id AND b.id=c.b_id;
     65   }
     66 } {8 9 2 9 2}
     67 do_test tkt3419-1.6 {
     68   execsql {
     69     select * FROM c, b, a WHERE a.id=2 AND b.a_id = a.id AND b.id=c.b_id;
     70   }
     71 } {8 9 9 2 2}
     72 
     73 finish_test
     74