pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Add subquery pullup handling for WindowClause runCondition 2+ messages / 1 participants [nested] [flat]
* pgsql: Add subquery pullup handling for WindowClause runCondition @ 2022-12-10 06:27 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: David Rowley @ 2022-12-10 06:27 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Add subquery pullup handling for WindowClause runCondition 9d9c02ccd added code to allow WindowAgg to take some shortcuts when a monotonic WindowFunc reached some value that it could never come back from due to the function's monotonic nature. That commit added a runCondition field to WindowClause to store the condition which, when it becomes false we can start taking shortcuts in nodeWindowAgg.c. Here we fix an issue where subquery pullups didn't properly update the runCondition to update the Vars to properly reference the new query level. Here we also add a missing call to preprocess_expression() for the WindowClause's runCondtion. The WindowFuncs in the targetlist will have had this process done, so we must also do it for the WindowFuncs in the runCondition so that they can be correctly found in the targetlist during setrefs.c Bug: #17709 Reported-by: Alexey Makhmutov Author: Richard Guo, David Rowley Discussion: https://postgr.es/m/17709-4f557160e3e8ee9a@postgresql.org Backpatch-through: 15, where 9d9c02ccd was introduced Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/94985c21020aa4a40d0dda1a26ac3e35a57e4681 Modified Files -------------- src/backend/optimizer/plan/planner.c | 3 +++ src/backend/optimizer/prep/prepjointree.c | 9 +++++++++ 2 files changed, 12 insertions(+) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Add subquery pullup handling for WindowClause runCondition @ 2022-12-10 06:28 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: David Rowley @ 2022-12-10 06:28 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Add subquery pullup handling for WindowClause runCondition 9d9c02ccd added code to allow WindowAgg to take some shortcuts when a monotonic WindowFunc reached some value that it could never come back from due to the function's monotonic nature. That commit added a runCondition field to WindowClause to store the condition which, when it becomes false we can start taking shortcuts in nodeWindowAgg.c. Here we fix an issue where subquery pullups didn't properly update the runCondition to update the Vars to properly reference the new query level. Here we also add a missing call to preprocess_expression() for the WindowClause's runCondtion. The WindowFuncs in the targetlist will have had this process done, so we must also do it for the WindowFuncs in the runCondition so that they can be correctly found in the targetlist during setrefs.c Bug: #17709 Reported-by: Alexey Makhmutov Author: Richard Guo, David Rowley Discussion: https://postgr.es/m/17709-4f557160e3e8ee9a@postgresql.org Backpatch-through: 15, where 9d9c02ccd was introduced Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/04788ee4c5efcfbf026b968a064fcdd74fcba154 Modified Files -------------- src/backend/optimizer/plan/planner.c | 3 +++ src/backend/optimizer/prep/prepjointree.c | 9 +++++++++ 2 files changed, 12 insertions(+) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2022-12-10 06:28 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2022-12-10 06:27 pgsql: Add subquery pullup handling for WindowClause runCondition David Rowley <drowley@postgresql.org> 2022-12-10 06:28 pgsql: Add subquery pullup handling for WindowClause runCondition David Rowley <drowley@postgresql.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox