• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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#
13# $Id: tkt3424.test,v 1.2 2009/06/05 17:09:12 drh Exp $
14
15set testdir [file dirname $argv0]
16source $testdir/tester.tcl
17
18do_test tkt3424-1.1 {
19  execsql {
20    CREATE TABLE names(id INTEGER, data TEXT, code TEXT);
21    INSERT INTO names VALUES(1,'E1','AAA');
22    INSERT INTO names VALUES(2,NULL,'BBB');
23
24    CREATE TABLE orig(code TEXT, data TEXT);
25    INSERT INTO orig VALUES('AAA','E1');
26    INSERT INTO orig VALUES('AAA','E2');
27    INSERT INTO orig VALUES('AAA','E3');
28    INSERT INTO orig VALUES('AAA','E4');
29    INSERT INTO orig VALUES('AAA','E5');
30  }
31} {}
32
33do_test tkt3424-1.2 {
34  execsql {
35    SELECT * FROM
36    names LEFT OUTER JOIN orig
37    ON names.data = orig.data AND names.code = orig.code;
38  }
39} {1 E1 AAA AAA E1 2 {} BBB {} {}}
40
41do_test tkt3424-1.3 {
42  execsql { CREATE INDEX udx_orig_code_data ON orig(code, data) }
43} {}
44
45do_test tkt3424-1.4 {
46  execsql {
47    SELECT * FROM
48    names LEFT OUTER JOIN orig
49    ON names.data = orig.data AND names.code = orig.code;
50  }
51} {1 E1 AAA AAA E1 2 {} BBB {} {}}
52
53finish_test
54