result of aggregation over some subset of
the input values, to produce a
new <replaceable class="parameter">state_data_type</replaceable> that
represents the result of aggregating over both sets of inputs. This
function can be thought of as
an <replaceable class="parameter">sfunc</replaceable>, where instead of
acting upon an individual input row and adding it to the running
aggregate state, it adds another aggregate state to the running state.
</para>
<para>
The <replaceable class="parameter">combinefunc</replaceable> must be
declared as taking two arguments of
the <replaceable class="parameter">state_data_type</replaceable> and
returning a value of
the <replaceable class="parameter">state_data_type</replaceable>.
Optionally this function may be <quote>strict</quote>. In this case the
function will not be called when either of the input states are null;
the other state will be taken as the correct result.
</para>
<para>
For aggregate functions
whose <replaceable class="parameter">state_data_type</replaceable>
is <type>internal</type>,
the <replaceable class="parameter">combinefunc</replaceable> must not
be strict. In this case
the <replaceable class="parameter">combinefunc</replaceable> must
ensure that null states are handled correctly and that the state being
returned is properly stored in the aggregate memory context.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">serialfunc</replaceable></term>
<listitem>
<para>
An aggregate function
whose <replaceable class="parameter">state_data_type</replaceable>
is <type>internal</type> can participate in parallel aggregation only if it
has a <replaceable class="parameter">serialfunc</replaceable> function,
which must serialize the aggregate state into a <type>bytea</type> value for
transmission to another process. This function must take a single
argument of type <type>internal</type> and return type <type>bytea</type>. A
corresponding <replaceable class="parameter">deserialfunc</replaceable>
is also required.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">deserialfunc</replaceable></term>
<listitem>
<para>
Deserialize a previously serialized aggregate state back into
<replaceable class="parameter">state_data_type</replaceable>. This
function must take two arguments of types <type>bytea</type>
and <type>internal</type>, and produce a result of type <type>internal</type>.
(Note: the second, <type>internal</type> argument is unused, but is required
for type safety reasons.)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">initial_condition</replaceable></term>
<listitem>
<para>
The initial setting for the state value. This must be a string
constant in the form accepted for the data type <replaceable
class="parameter">state_data_type</replaceable>. If not
specified, the state value starts out null.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">msfunc</replaceable></term>
<listitem>
<para>
The name of the forward state transition function to be called for each
input row in moving-aggregate mode. This is exactly like the regular
transition function, except that its first argument and result are of
type <replaceable>mstate_data_type</replaceable>, which might be different
from <replaceable>state_data_type</replaceable>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">minvfunc</replaceable></term>
<listitem>
<para>
The name of the inverse