<literal>VARIADIC</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">argname</replaceable></term>
<listitem>
<para>
The name of an argument. This is currently only useful for
documentation purposes. If omitted, the argument has no name.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">arg_data_type</replaceable></term>
<listitem>
<para>
An input data type on which this aggregate function operates.
To create a zero-argument aggregate function, write <literal>*</literal>
in place of the list of argument specifications. (An example of such an
aggregate is <function>count(*)</function>.)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">base_type</replaceable></term>
<listitem>
<para>
In the old syntax for <command>CREATE AGGREGATE</command>, the input data type
is specified by a <literal>basetype</literal> parameter rather than being
written next to the aggregate name. Note that this syntax allows
only one input parameter. To define a zero-argument aggregate function
with this syntax, specify the <literal>basetype</literal> as
<literal>"ANY"</literal> (not <literal>*</literal>).
Ordered-set aggregates cannot be defined with the old syntax.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">sfunc</replaceable></term>
<listitem>
<para>
The name of the state transition function to be called for each
input row. For a normal <replaceable class="parameter">N</replaceable>-argument
aggregate function, the <replaceable class="parameter">sfunc</replaceable>
must take <replaceable class="parameter">N</replaceable>+1 arguments,
the first being of type <replaceable
class="parameter">state_data_type</replaceable> and the rest
matching the declared input data type(s) of the aggregate.
The function must return a value of type <replaceable
class="parameter">state_data_type</replaceable>. This function
takes the current state value and the current input data value(s),
and returns the next state value.
</para>
<para>
For ordered-set (including hypothetical-set) aggregates, the state
transition function receives only the current state value and the
aggregated arguments, not the direct arguments. Otherwise it is the
same.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">state_data_type</replaceable></term>
<listitem>
<para>
The data type for the aggregate's state value.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">state_data_size</replaceable></term>
<listitem>
<para>
The approximate average size (in bytes) of the aggregate's state value.
If this parameter is omitted or is zero, a default estimate is used
based on the <replaceable>state_data_type</replaceable>.
The planner uses this value to estimate the memory required for a
grouped aggregate query.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">ffunc</replaceable></term>
<listitem>
<para>
The name of the final function called to compute the aggregate's
result after all input rows have been traversed.
For a normal aggregate, this function
must take a single argument of type <replaceable
class="parameter">state_data_type</replaceable>. The return
data type of the aggregate is defined as the return type of this
function. If <replaceable class="parameter">ffunc</replaceable>
is not specified, then the ending state value is used as the
aggregate's result,