aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2013-01-09 11:31:17 +0000
committerdrh <drh@noemail.net>2013-01-09 11:31:17 +0000
commit29a8bf8e94aaf83ac8a979dce9699b9d19a2ce9a (patch)
treeed4f8d6c9c08403b34a7730d068b361240ca9e30 /src
parent97a3e09f4e76ea5baaf1d1ac37bc8ac5c29c81e5 (diff)
downloadsqlite-29a8bf8e94aaf83ac8a979dce9699b9d19a2ce9a.tar.gz
sqlite-29a8bf8e94aaf83ac8a979dce9699b9d19a2ce9a.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/where.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/where.c b/src/where.c
index 3b64b411d..6e096e5c6 100644
--- a/src/where.c
+++ b/src/where.c
@@ -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 ){