Re: Combination of ordered-set aggregate function terminates JDBC connection on PostgreSQL 9.6.5
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: David Rowley <david.rowley@2ndquadrant.com>,
Lukas Eder <lukas.eder@gmail.com>,
PostgreSQL mailing lists <pgsql-bugs@postgresql.org>
Date: 2017-10-12T16:34:52Z
Lists: pgsql-bugs
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Treat aggregate direct arguments as per-agg data not per-trans data.
- cf5ba7c30c04 11.0 landed
-
Allow the built-in ordered-set aggregates to share transition state.
- be0ebb65f512 11.0 landed
-
Fix AggGetAggref() so it won't lie to aggregate final functions.
- 305cf1fd7239 11.0 landed
- d48bf6a94d29 10.1 landed
- aa1e9b3a4661 9.6.6 landed
-
Prevent sharing transition states between ordered-set aggregates.
- 52328727bea4 11.0 landed
- 96cfc7e19ae1 9.6.6 landed
- 604723d29a86 10.1 landed
Attachments
- make-AggGetAggref-honest.patch (text/x-diff) patch
I wrote: > Thinking about it more clearly, if a transition function is being run > on behalf of several different Aggrefs (with identical input states), > then no, the transition function should not care which Aggref it > looks at. As you say it mustn't do anything different on the basis of > the finalfn-related fields. The problem occurs when a finalfn calls > AggGetAggref --- then, I think that the finalfn is entirely entitled > to expect that it will see its own Aggref, not some other one that > happens to share input+transition. Concretely, I think we need to do the attached. This seems like a bug fix to me, so I'm inclined to back-patch it. In the back branches we could put the extra AggState field at the end, to minimize ABI-break hazards. BTW ... I was quite surprised to notice that the aggdirectargs are treated as a property that has to be matched in order to combine transition states. They aren't used during the transition phase, so this seems like a pointless constraint. We could move the aggdirectargs ExprState list to AggStatePerAggData and treat the aggdirectargs as part of the finalfn-related data, instead. As long as we're not merging states at all for OSAs, this is moot, but it seems like something to fix along with that. regards, tom lane