From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi> |
Cc: | David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, Lukas Eder <lukas(dot)eder(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: Combination of ordered-set aggregate function terminates JDBC connection on PostgreSQL 9.6.5 |
Date: | 2017-10-12 16:34:52 |
Message-ID: | 29149.1507826092@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
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
Attachment | Content-Type | Size |
---|---|---|
make-AggGetAggref-honest.patch | text/x-diff | 4.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2017-10-13 04:29:32 | Re: BUG #14849: jsonb_build_object doesn't like VARIADIC calls very much |
Previous Message | Tom Lane | 2017-10-12 15:06:27 | Re: Improper const-evaluation of HAVING with grouping sets and subquery pullup |