Fix an over-aggressive optimization of ORDER BY on a three-way join where the

second table is UNIQUE and the ORDER BY occurs on the third table.
Ticket [598f5f7596b0557].

FossilOrigin-Name: 5774f2175ce621dfc4b6b93f7ee13fd66f3ec2b9
This commit is contained in:
drh 2013-01-09 11:31:17 +00:00
parent 97a3e09f4e
commit 29a8bf8e94
3 changed files with 8 additions and 8 deletions

View File

@ -1,5 +1,5 @@
C Fix\sthe\sdate\son\sthe\snew\sorderby3.test\stest\scase.
D 2013-01-09T11:27:48.059
C Fix\san\sover-aggressive\soptimization\sof\sORDER\sBY\son\sa\sthree-way\sjoin\swhere\sthe\nsecond\stable\sis\sUNIQUE\sand\sthe\sORDER\sBY\soccurs\son\sthe\sthird\stable.\nTicket\s[598f5f7596b0557].
D 2013-01-09T11:31:17.442
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in a48faa9e7dd7d556d84f5456eabe5825dd8a6282
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -251,7 +251,7 @@ F src/vtab.c b05e5f1f4902461ba9f5fc49bb7eb7c3a0741a83
F src/wal.c f5c7b5027d0ed0e9bc9afeb4a3a8dfea762ec7d2
F src/wal.h 29c197540b19044e6cd73487017e5e47a1d3dac6
F src/walker.c 3d75ba73de15e0f8cd0737643badbeb0e002f07b
F src/where.c b971ee2d1a4f5db1b4cfd5cb85e69f34e61781d0
F src/where.c 4c7fec9cfa3af06597ae039e5f0ec03cbee34c58
F test/8_3_names.test 631ea964a3edb091cf73c3b540f6bcfdb36ce823
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
F test/aggnested.test 45c0201e28045ad38a530b5a144b73cd4aa2cfd6
@ -1032,7 +1032,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
P 598f5f7596b0557b22f31e6643a59ff9096fd023
R 4e5574cf3bdb773e3a61e5a8e0ac5a06
P 7249bfc2ca57624d73f2be0197a9807c58463c48
R fcfe7ea587f64ef92e6849f97c544ccd
U drh
Z 7d9f7624ec9e6442215cdf36ee5e32eb
Z 6e8a59f9682c67ec0cee9fce08b8ae23

View File

@ -1 +1 @@
7249bfc2ca57624d73f2be0197a9807c58463c48
5774f2175ce621dfc4b6b93f7ee13fd66f3ec2b9

View File

@ -3302,7 +3302,7 @@ static void bestBtreeIndex(WhereBestIdx *p){
pc.plan.nOBSat = isSortingIndex(p, pProbe, iCur, &bRev);
WHERETRACE((" --> after isSortingIndex: bRev=%d nOBSat=%d\n",
bRev, pc.plan.nOBSat));
if( nPriorSat<pc.plan.nOBSat || (pc.plan.wsFlags & WHERE_UNIQUE)!=0 ){
if( nPriorSat<pc.plan.nOBSat || (pc.plan.wsFlags & WHERE_ALL_UNIQUE)!=0 ){
pc.plan.wsFlags |= WHERE_ORDERED;
}
if( nOrderBy==pc.plan.nOBSat ){