570b935c2a
does not put table A after table C. Ticket #1652. (CVS 3052) FossilOrigin-Name: 248b9be93d9532e31c640432b75c3310e180acb3
50 lines
1.4 KiB
Plaintext
50 lines
1.4 KiB
Plaintext
# 2006 January 31
|
|
#
|
|
# The author disclaims copyright to this source code. In place of
|
|
# a legal notice, here is a blessing:
|
|
#
|
|
# May you do good and not evil.
|
|
# May you find forgiveness for yourself and forgive others.
|
|
# May you share freely, never taking more than you give.
|
|
#
|
|
#***********************************************************************
|
|
# This file implements regression tests for SQLite library. The
|
|
# focus of this file is testing the join reordering optimization
|
|
# in cases that include a LEFT JOIN.
|
|
#
|
|
# $Id: where3.test,v 1.1 2006/02/01 02:45:02 drh Exp $
|
|
|
|
set testdir [file dirname $argv0]
|
|
source $testdir/tester.tcl
|
|
|
|
# The following is from ticket #1652.
|
|
#
|
|
# A comma join then a left outer join: A,B left join C.
|
|
# Arrange indices so that the B table is chosen to go first.
|
|
# Also put an index on C, but make sure that A is chosen before C.
|
|
#
|
|
do_test where3-1.1 {
|
|
execsql {
|
|
CREATE TABLE t1(a, b);
|
|
CREATE TABLE t2(p, q);
|
|
CREATE TABLE t3(x, y);
|
|
|
|
INSERT INTO t1 VALUES(111,'one');
|
|
INSERT INTO t1 VALUES(222,'two');
|
|
INSERT INTO t1 VALUES(333,'three');
|
|
|
|
INSERT INTO t2 VALUES(1,111);
|
|
INSERT INTO t2 VALUES(2,222);
|
|
INSERT INTO t2 VALUES(4,444);
|
|
CREATE INDEX t2i1 ON t2(p);
|
|
|
|
INSERT INTO t3 VALUES(999,'nine');
|
|
CREATE INDEX t3i1 ON t3(x);
|
|
|
|
SELECT * FROM t1, t2 LEFT JOIN t3 ON q=x WHERE p=2 AND a=q;
|
|
}
|
|
} {222 two 2 222 {} {}}
|
|
|
|
|
|
finish_test
|