aboutsummaryrefslogtreecommitdiff
path: root/contrib/pageinspect/gistfuncs.c
diff options
context:
space:
mode:
authorDavid Rowley <drowley@postgresql.org>2023-02-13 17:11:03 +1300
committerDavid Rowley <drowley@postgresql.org>2023-02-13 17:11:03 +1300
commit836c31ba508c154bc4c4ebb6270761586a6df797 (patch)
tree14857b1e209e0e3b80550518573a91ba9abd0f18 /contrib/pageinspect/gistfuncs.c
parent2a507f6fd8b75c5197a58aac7c8003befd072003 (diff)
downloadpostgresql-836c31ba508c154bc4c4ebb6270761586a6df797.tar.gz
postgresql-836c31ba508c154bc4c4ebb6270761586a6df797.zip
Disable WindowAgg inverse transitions when subplans are present
When an aggregate function is used as a WindowFunc and a tuple transitions out of the window frame, we ordinarily try to make use of the aggregate function's inverse transition function to "unaggregate" the exiting tuple. This optimization is disabled for various cases, including when the aggregate contains a volatile function. In such a case we'd be unable to ensure that the transition value was calculated to the same value during transitions and inverse transitions. Unfortunately, we did this check by calling contain_volatile_functions() which does not recursively search SubPlans for volatile functions. If the aggregate function's arguments or its FILTER clause contained a subplan with volatile functions then we'd fail to notice this. Here we fix this by just disabling the optimization when the WindowFunc contains any subplans. Volatile functions are not the only reason that a subplan may have nonrepeatable results. Bug: #17777 Reported-by: Anban Company Discussion: https://postgr.es/m/17777-860b739b6efde977%40postgresql.org Reviewed-by: Tom Lane Backpatch-through: 11
Diffstat (limited to 'contrib/pageinspect/gistfuncs.c')
0 files changed, 0 insertions, 0 deletions