mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-21 09:00:59 +03:00
Do not allow a virtual table to cancel the ORDER BY clause unless all
outer loops are guaranteed to return no more than one row result. Candidate fix for ticket [ba82a4a41eac1]. FossilOrigin-Name: 49cfa14fceeef2d55b449eb927c283ce6f650c07
This commit is contained in:
11
src/where.c
11
src/where.c
@@ -2400,6 +2400,17 @@ static void bestVirtualIndex(WhereBestIdx *p){
|
||||
}
|
||||
if( i>=pIdxInfo->nConstraint ) break;
|
||||
}
|
||||
|
||||
/* The orderByConsumed signal is only valid if all outer loops collectively
|
||||
** generate just a single row of output.
|
||||
*/
|
||||
if( pIdxInfo->orderByConsumed ){
|
||||
for(i=0; i<p->i; i++){
|
||||
if( (p->aLevel[i].plan.wsFlags & WHERE_UNIQUE)==0 ){
|
||||
pIdxInfo->orderByConsumed = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If there is an ORDER BY clause, and the selected virtual table index
|
||||
** does not satisfy it, increase the cost of the scan accordingly. This
|
||||
|
||||
Reference in New Issue
Block a user