From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Jeff Janes <jeff(dot)janes(at)gmail(dot)com> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: partial aggregation with internal state type |
Date: | 2017-06-09 16:06:36 |
Message-ID: | 31823.1497024396@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Jeff Janes <jeff(dot)janes(at)gmail(dot)com> writes:
> The docs for creating aggregates for 9.6 and beyond say:
> "For aggregate functions whose state_data_type is internal, the combinefunc
> must not be strict. In this case the combinefunc must ensure that null
> states are handled correctly and that the state being returned is properly
> stored in the aggregate memory context."
> Since combinefunc with an internal type is only useful when serialfunc and
> deserialfunc are also defined, why can't the built-in machinery just do the
> right thing when faced with a strict combinefunc?
The issue is how to initialize the state value to begin with.
I suppose you're imagining that we could fill pg_aggregate.agginitval
with something that the serialfunc could read. But that would place
serious constraints on the serialization format, like that it be
machine-independent and valid as text.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2017-06-09 16:17:03 | Re: strcmp() tie-breaker for identical ICU-collated strings |
Previous Message | konst583 | 2017-06-09 16:01:09 | BUG #14699: Statement trigger and logical replication |