3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
12 # This file implements regression tests for SQLite library. The
13 # focus of this file is testing the fix for ticket #3357.
15 # $Id: tkt3357.test,v 1.2 2009/06/05 17:09:12 drh Exp $
17 set testdir [file dirname $argv0]
18 source $testdir/tester.tcl
22 create table a(id integer primary key, b_id integer, myvalue varchar);
23 create table b(id integer primary key, bvalue varchar);
24 insert into a(b_id, myvalue) values(1,'Test');
25 insert into a(b_id, myvalue) values(1,'Test2');
26 insert into a(b_id, myvalue) values(1,'Test3');
27 insert into b(bvalue) values('btest');
33 SELECT cc.id, cc.b_id, cc.myvalue, dd.bvalue
35 SELECT DISTINCT a.id, a.b_id, a.myvalue FROM a
36 INNER JOIN b ON a.b_id = b.id WHERE b.bvalue = 'btest'
38 LEFT OUTER JOIN b dd ON cc.b_id = dd.id
40 } {1 1 Test btest 2 1 Test2 btest 3 1 Test3 btest}
44 SELECT cc.id, cc.b_id, cc.myvalue
46 SELECT a.id, a.b_id, a.myvalue
47 FROM a, b WHERE a.b_id = b.id
49 LEFT OUTER JOIN b dd ON cc.b_id = dd.id
51 } {1 1 Test 2 1 Test2 3 1 Test3}
55 SELECT cc.id, cc.b_id, cc.myvalue
57 SELECT DISTINCT a.id, a.b_id, a.myvalue
58 FROM a, b WHERE a.b_id = b.id
60 LEFT OUTER JOIN b dd ON cc.b_id = dd.id
62 } {1 1 Test 2 1 Test2 3 1 Test3}