1
0
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:
dan
2019-05-03 17:19:10 +00:00
parent 5bf4644f41
commit ac4085bc2c
4 changed files with 27 additions and 10 deletions

View File

@@ -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;