On Tue, Feb 24, 2015 at 2:20 PM, Peter Eisentraut <peter_e@gmx.net> wrote:
> On 2/20/15 3:09 PM, Tomas Vondra wrote:
>> The 'combine' function gets two such 'state' values, while transition
>> gets 'state' + next value.
>
> I think the combine function is not actually a property of the
> aggregate, but a property of the transition function. If two aggregates
> have the same transition function, they will also have the same combine
> function. The combine function really just says, how do you combine two
> series of these function calls. Say maybe this should be put into
> pg_proc instead. (Or you make the transition functions transition
> operators and put the info into pg_operator instead, which is where
> function call optimization information is usually kept.)
This seems like a weird design to me. It's probably true that if the
transition function is the same, the state-combiner function will also
be the same. But the state-combiner function is only going to exist
for aggregate transition functions, not functions or operators in
general. So linking it from pg_proc or pg_operator feels wrong to me.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company