1
0
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:
drh
2013-01-09 11:31:17 +00:00
parent 97a3e09f4e
commit 29a8bf8e94
3 changed files with 8 additions and 8 deletions

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 ){