]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix incorrect logic for determining safe WindowAgg run conditions
authorDavid Rowley <drowley@postgresql.org>
Fri, 17 Mar 2023 02:49:53 +0000 (15:49 +1300)
committerDavid Rowley <drowley@postgresql.org>
Fri, 17 Mar 2023 02:49:53 +0000 (15:49 +1300)
commiteb7d043c9bbadb75a87385113c578f1b30e9d195
tree079ecb710a843852853d6a59834f1410af35c0ca
parentb9f8d1cbad7cdc4d0d29c5cdbb14e179a7111439
Fix incorrect logic for determining safe WindowAgg run conditions

The logic added in 9d9c02ccd to determine when a qual can be used as a
WindowClause run condition failed to correctly check for subqueries in the
qual.  This was being done correctly for normal subquery qual pushdowns,
it's just that 9d9c02ccd failed to follow the lead on that.

This also fixes various other cases where transforming the qual into a
WindowClause run condition in the subquery should have been disallowed.

Bug: #17826
Reported-by: Anban Company
Discussion: https://postgr.es/m/17826-7d8750952f19a5f5@postgresql.org
Backpatch-through: 15, where 9d9c02ccd was introduced.
src/backend/optimizer/path/allpaths.c
src/test/regress/expected/window.out
src/test/regress/sql/window.sql