diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-02-08 20:39:52 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-02-08 20:39:52 +0000 |
| commit | d5768dce10576c2fb1254c03fb29475d4fac6bb4 (patch) | |
| tree | 7b971cb06b6671d66df26027909e1d9355d65d14 /doc/src | |
| parent | 4d3d2e2b0325e3d6d524c6801b7439d3aaea4520 (diff) | |
Create an official API function for C functions to use to check if they are
being called as aggregates, and to get the aggregate transition state memory
context if needed. Use it instead of poking directly into AggState and
WindowAggState in places that shouldn't know so much.
We should have done this in 8.4, probably, but better late than never.
Revised version of a patch by Hitoshi Harada.
Diffstat (limited to 'doc/src')
| -rw-r--r-- | doc/src/sgml/xaggr.sgml | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/doc/src/sgml/xaggr.sgml b/doc/src/sgml/xaggr.sgml index 1175b3640d7..1c34957a166 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.38 2009/06/20 18:45:28 tgl Exp $ --> +<!-- $PostgreSQL: pgsql/doc/src/sgml/xaggr.sgml,v 1.39 2010/02/08 20:39:51 tgl Exp $ --> <sect1 id="xaggr"> <title>User-Defined Aggregates</title> @@ -166,14 +166,10 @@ SELECT attrelid::regclass, array_accum(atttypid::regtype) <para> A function written in C can detect that it is being called as an - aggregate transition or final function by seeing if it was passed - an <structname>AggState</> or <structname>WindowAggState</> node - as the function call <quote>context</>, - for example by: + aggregate transition or final function by calling + <function>AggCheckCallContext</>, for example: <programlisting> - if (fcinfo->context && - (IsA(fcinfo->context, AggState) || - IsA(fcinfo->context, WindowAggState))) + if (AggCheckCallContext(fcinfo, NULL)) </programlisting> One reason for checking this is that when it is true for a transition function, the first input |
