forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit836c31b
committed
Disable WindowAgg inverse transitions when subplans are present
When an aggregate function is used as a WindowFunc and a tuple transitionsout of the window frame, we ordinarily try to make use of the aggregatefunction's inverse transition function to "unaggregate" the exiting tuple.This optimization is disabled for various cases, including when theaggregate contains a volatile function. In such a case we'd be unable toensure that the transition value was calculated to the same value duringtransitions and inverse transitions. Unfortunately, we did this check bycalling contain_volatile_functions() which does not recursively searchSubPlans for volatile functions. If the aggregate function's arguments orits FILTER clause contained a subplan with volatile functions then we'dfail to notice this.Here we fix this by just disabling the optimization when the WindowFunccontains any subplans. Volatile functions are not the only reason that asubplan may have nonrepeatable results.Bug: #17777Reported-by: Anban CompanyDiscussion:https://postgr.es/m/17777-860b739b6efde977%40postgresql.orgReviewed-by: Tom LaneBackpatch-through: 111 parent2a507f6 commit836c31b
1 file changed
+10
-1
lines changedLines changed: 10 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
41 | 41 |
| |
42 | 42 |
| |
43 | 43 |
| |
| 44 | + | |
44 | 45 |
| |
45 | 46 |
| |
46 | 47 |
| |
| |||
2803 | 2804 |
| |
2804 | 2805 |
| |
2805 | 2806 |
| |
| 2807 | + | |
| 2808 | + | |
| 2809 | + | |
| 2810 | + | |
| 2811 | + | |
| 2812 | + | |
2806 | 2813 |
| |
2807 | 2814 |
| |
2808 | 2815 |
| |
2809 | 2816 |
| |
2810 |
| - | |
| 2817 | + | |
2811 | 2818 |
| |
2812 | 2819 |
| |
2813 | 2820 |
| |
2814 | 2821 |
| |
2815 | 2822 |
| |
| 2823 | + | |
| 2824 | + | |
2816 | 2825 |
| |
2817 | 2826 |
| |
2818 | 2827 |
| |
|
0 commit comments
Comments
(0)