1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-10 01:02:56 +03:00

Enable the index-on-expression optimization even when the expression is

used as an argument to an aggregate function.

FossilOrigin-Name: 462b3c7f39724dc814f55e7a225e7d0c48f81c524cdda797a66e9e198c35ce58
This commit is contained in:
drh
2022-10-15 12:01:40 +00:00
parent 7a98937db2
commit f3adb7c430
3 changed files with 14 additions and 8 deletions

View File

@@ -5618,7 +5618,13 @@ int sqlite3ExprCompare(
if( pB->op==TK_COLLATE && sqlite3ExprCompare(pParse, pA,pB->pLeft,iTab)<2 ){
return 1;
}
return 2;
if( pA->op==TK_AGG_COLUMN && pB->op==TK_COLUMN
&& pB->iTable<0 && pA->iTable==iTab
){
/* fall through */
}else{
return 2;
}
}
assert( !ExprHasProperty(pA, EP_IntValue) );
assert( !ExprHasProperty(pB, EP_IntValue) );