mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-11 01:42:22 +03:00
Fix a problem where self-joins on views that are aggregate queries may return the wrong result.
FossilOrigin-Name: 74ef97bf51dd531a277cf22fa4d42043d93799d5a5bd550812648834460fe0b7
This commit is contained in:
@@ -5481,7 +5481,9 @@ static struct SrcList_item *isSelfJoinView(
|
||||
** names in the same FROM clause. */
|
||||
continue;
|
||||
}
|
||||
if( sqlite3ExprCompare(0, pThis->pSelect->pWhere, pS1->pWhere, -1) ){
|
||||
if( sqlite3ExprCompare(0, pThis->pSelect->pWhere, pS1->pWhere, -1)
|
||||
|| sqlite3ExprCompare(0, pThis->pSelect->pHaving, pS1->pHaving, -1)
|
||||
){
|
||||
/* The view was modified by some other optimization such as
|
||||
** pushDownWhereTerms() */
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user