diff options
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/xaggr.sgml | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/doc/src/sgml/xaggr.sgml b/doc/src/sgml/xaggr.sgml index b223888f9ed..1175b3640d7 100644 --- a/doc/src/sgml/xaggr.sgml +++ b/doc/src/sgml/xaggr.sgml @@ -1,4 +1,4 @@ -<!-- $PostgreSQL: pgsql/doc/src/sgml/xaggr.sgml,v 1.37 2008/12/28 18:53:54 tgl Exp $ --> +<!-- $PostgreSQL: pgsql/doc/src/sgml/xaggr.sgml,v 1.38 2009/06/20 18:45:28 tgl Exp $ --> <sect1 id="xaggr"> <title>User-Defined Aggregates</title> @@ -175,10 +175,14 @@ SELECT attrelid::regclass, array_accum(atttypid::regtype) (IsA(fcinfo->context, AggState) || IsA(fcinfo->context, WindowAggState))) </programlisting> - One reason for checking this is that when it is true, the first input + One reason for checking this is that when it is true for a transition + function, the first input must be a temporary transition value and can therefore safely be modified in-place rather than allocating a new copy. (This is the <emphasis>only</> - case where it is safe for a function to modify a pass-by-reference input.) + case where it is safe for a function to modify a pass-by-reference input. + In particular, aggregate final functions should not modify their inputs in + any case, because in some cases they will be re-executed on the same + final transition value.) See <literal>int8inc()</> for an example. </para> |