summaryrefslogtreecommitdiff
path: root/doc/src/sgml/xaggr.sgml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src/sgml/xaggr.sgml')
-rw-r--r--doc/src/sgml/xaggr.sgml16
1 files changed, 15 insertions, 1 deletions
diff --git a/doc/src/sgml/xaggr.sgml b/doc/src/sgml/xaggr.sgml
index fa98572ed6..79a9f288b2 100644
--- a/doc/src/sgml/xaggr.sgml
+++ b/doc/src/sgml/xaggr.sgml
@@ -626,7 +626,7 @@ if (AggCheckCallContext(fcinfo, NULL))
function, the first input
must be a temporary state value and can therefore safely be modified
in-place rather than allocating a new copy.
- See <literal>int8inc()</> for an example.
+ See <function>int8inc()</> for an example.
(This is the <emphasis>only</>
case where it is safe for a function to modify a pass-by-reference input.
In particular, final functions for normal aggregates must not
@@ -635,6 +635,20 @@ if (AggCheckCallContext(fcinfo, NULL))
</para>
<para>
+ The second argument of <function>AggCheckCallContext</> can be used to
+ retrieve the memory context in which aggregate state values are being kept.
+ This is useful for transition functions that wish to use <quote>expanded</>
+ objects (see <xref linkend="xtypes-toast">) as their state values.
+ On first call, the transition function should return an expanded object
+ whose memory context is a child of the aggregate state context, and then
+ keep returning the same expanded object on subsequent calls. See
+ <function>array_append()</> for an example. (<function>array_append()</>
+ is not the transition function of any built-in aggregate, but it is written
+ to behave efficiently when used as transition function of a custom
+ aggregate.)
+ </para>
+
+ <para>
Another support routine available to aggregate functions written in C
is <function>AggGetAggref</>, which returns the <literal>Aggref</>
parse node that defines the aggregate call. This is mainly useful