Fix a problem in the previous commit affecting queries with three or more tables joined together to the right of a LEFT or CROSS JOIN operator.

FossilOrigin-Name: d8d89d69a490a708b83147945f74134ae0e4b387
This commit is contained in:
dan 2016-03-05 21:32:14 +00:00
parent 6a1e076939
commit 104ead923e
4 changed files with 22 additions and 11 deletions

View File

@ -1,5 +1,5 @@
C Change\sthe\sway\sSQLite\sinvokes\sthe\sxBestIndex\smethod\sof\svirtual\stables\sso\sthat\sN-way\sjoins\sinvolving\svirtual\stables\swork\sas\sexpected.
D 2016-03-05T21:07:49.054
C Fix\sa\sproblem\sin\sthe\sprevious\scommit\saffecting\squeries\swith\sthree\sor\smore\stables\sjoined\stogether\sto\sthe\sright\sof\sa\sLEFT\sor\sCROSS\sJOIN\soperator.
D 2016-03-05T21:32:14.419
F Makefile.in f53429fb2f313c099283659d0df6f20f932c861f
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc df0bf9ff7f8b3f4dd9fb4cc43f92fe58f6ec5c66
@ -428,7 +428,7 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
F src/wal.c 10deb6b43887662691e5f53d10b3c171c401169b
F src/wal.h 2f7c831cf3b071fa548bf2d5cac640846a7ff19c
F src/walker.c 0f142b5bd3ed2041fc52d773880748b212e63354
F src/where.c bada38bf45ea4437318164f915243b3f0822ceda
F src/where.c ccc62c39af1e6340f6af36fcf68efb96482d4c3a
F src/whereInt.h 93297d56edd137b7ea004490690fb6e2ce028a34
F src/wherecode.c 3ca820435c5b597bb50e63ed11e938786fe5c23e
F src/whereexpr.c fb87944b1254234e5bba671aaf6dee476241506a
@ -493,7 +493,7 @@ F test/badutf.test d5360fc31f643d37a973ab0d8b4fb85799c3169f
F test/badutf2.test f5bc7f2d280670ecd79b9cf4f0f1760c607fe51f
F test/bc_common.tcl 3eda41ef9cda7d5f6c205462c96228b301da4191
F test/bestindex1.test e228fe1e3794dbe20271481164e000d695abcd24
F test/bestindex2.test b5c1fbcf7a6e73b22763445262399c9fc50276bc
F test/bestindex2.test 10f2c6791f1cd0de414012528cd10a114648fd8f
F test/between.test 34d375fb5ce1ae283ffe82b6b233e9f38e84fc6c
F test/bigfile.test aa74f4e5db51c8e54a1d9de9fa65d01d1eb20b59
F test/bigfile2.test 1b489a3a39ae90c7f027b79110d6b4e1dbc71bfc
@ -1453,7 +1453,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 5f2a262d3f6b1531001326faf1d3b3d92c20a30a fd7cd0609381a85673d1f737ebeb19dde3de180f
R 8203917822af6549d587abdbaf41bca8
P 195444380bafd3d95d37ad83047c75ca20978de4
R e0527fe33379f8b0f9960c0e82e97b5e
U dan
Z 91287ee7a6808d5de733f697deaa38da
Z e8beaa0235978227df4d188254085ea8

View File

@ -1 +1 @@
195444380bafd3d95d37ad83047c75ca20978de4
d8d89d69a490a708b83147945f74134ae0e4b387

View File

@ -2994,7 +2994,7 @@ static int whereLoopAddVirtual(
mPrev = mNext;
if( mNext==(Bitmask)(-1) ) break;
if( mNext==mBest || mNext==mBestNoIn ) continue;
rc = whereLoopAddVirtualOne(pBuilder, mExtra, mNext, 0, p, &bIn);
rc = whereLoopAddVirtualOne(pBuilder, mExtra, mNext|mExtra, 0, p, &bIn);
if( pNew->prereq==mExtra ){
seenZero = 1;
if( bIn==0 ) seenZeroNoIN = 1;

View File

@ -113,8 +113,6 @@ do_eqp_test 1.5 {
0 2 2 {SCAN TABLE t3 VIRTUAL TABLE INDEX 0:indexed(e=?)}
}
# This is the one that fails (as of 2016/3/3).
#
do_eqp_test 1.6 {
SELECT * FROM t1, t2, t3 WHERE t2.c = +t1.b AND t3.e = t2.d
} {
@ -123,5 +121,18 @@ do_eqp_test 1.6 {
0 2 2 {SCAN TABLE t3 VIRTUAL TABLE INDEX 0:indexed(e=?)}
}
do_execsql_test 1.7.1 {
CREATE TABLE x1(a, b);
}
do_eqp_test 1.7.2 {
SELECT * FROM x1 CROSS JOIN t1, t2, t3
WHERE t1.a = t2.c AND t1.b = t3.e
} {
0 0 0 {SCAN TABLE x1}
0 1 1 {SCAN TABLE t1 VIRTUAL TABLE INDEX 0:}
0 2 2 {SCAN TABLE t2 VIRTUAL TABLE INDEX 0:indexed(c=?)}
0 3 3 {SCAN TABLE t3 VIRTUAL TABLE INDEX 0:indexed(e=?)}
}
finish_test