mirror of
https://github.com/sqlite/sqlite.git
synced 2026-01-06 08:01:16 +03:00
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:
@@ -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 ){
|
||||
|
||||
Reference in New Issue
Block a user