OLD | NEW |
| (Empty) |
1 # 2008 September 1 | |
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 #3357. | |
14 # | |
15 # $Id: tkt3357.test,v 1.2 2009/06/05 17:09:12 drh Exp $ | |
16 | |
17 set testdir [file dirname $argv0] | |
18 source $testdir/tester.tcl | |
19 | |
20 do_test tkt3357-1.1 { | |
21 execsql { | |
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'); | |
28 } | |
29 } {} | |
30 | |
31 do_test tkt3357-1.2 { | |
32 execsql { | |
33 SELECT cc.id, cc.b_id, cc.myvalue, dd.bvalue | |
34 FROM ( | |
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' | |
37 ) cc | |
38 LEFT OUTER JOIN b dd ON cc.b_id = dd.id | |
39 } | |
40 } {1 1 Test btest 2 1 Test2 btest 3 1 Test3 btest} | |
41 | |
42 do_test tkt3357-1.3 { | |
43 execsql { | |
44 SELECT cc.id, cc.b_id, cc.myvalue | |
45 FROM ( | |
46 SELECT a.id, a.b_id, a.myvalue | |
47 FROM a, b WHERE a.b_id = b.id | |
48 ) cc | |
49 LEFT OUTER JOIN b dd ON cc.b_id = dd.id | |
50 } | |
51 } {1 1 Test 2 1 Test2 3 1 Test3} | |
52 | |
53 do_test tkt3357-1.4 { | |
54 execsql { | |
55 SELECT cc.id, cc.b_id, cc.myvalue | |
56 FROM ( | |
57 SELECT DISTINCT a.id, a.b_id, a.myvalue | |
58 FROM a, b WHERE a.b_id = b.id | |
59 ) cc | |
60 LEFT OUTER JOIN b dd ON cc.b_id = dd.id | |
61 } | |
62 } {1 1 Test 2 1 Test2 3 1 Test3} | |
63 | |
64 finish_test | |
OLD | NEW |