mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-10 01:02:56 +03:00
When doing a DISTINCT aggregate that contains an ORDER BY, only the
arguments to the aggregate need to be distinct, not the ORDER BY terms. FossilOrigin-Name: d2dbbdf7194bab4e5e3b74d3dbffb012a335829824c775c72dd7347c013d2125
This commit is contained in:
@@ -6806,16 +6806,17 @@ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){
|
||||
pItem->iOBTab = pParse->nTab++;
|
||||
pOBList = pExpr->pLeft->x.pList;
|
||||
assert( pOBList->nExpr>0 );
|
||||
assert( pItem->bOBUnique==0 );
|
||||
if( pOBList->nExpr==1
|
||||
&& nArg==1
|
||||
&& sqlite3ExprCompare(0,pOBList->a[0].pExpr,
|
||||
pExpr->x.pList->a[0].pExpr,0)==0
|
||||
){
|
||||
pItem->bOBPayload = 0;
|
||||
pItem->bOBUnique = ExprHasProperty(pExpr, EP_Distinct);
|
||||
}else{
|
||||
pItem->bOBPayload = 1;
|
||||
}
|
||||
pItem->bOBUnique = ExprHasProperty(pExpr, EP_Distinct);
|
||||
}else{
|
||||
pItem->iOBTab = -1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user