summaryrefslogtreecommitdiff
path: root/src/include/fmgr.h
diff options
context:
space:
mode:
authorTom Lane2010-02-08 20:39:52 +0000
committerTom Lane2010-02-08 20:39:52 +0000
commitd5768dce10576c2fb1254c03fb29475d4fac6bb4 (patch)
tree7b971cb06b6671d66df26027909e1d9355d65d14 /src/include/fmgr.h
parent4d3d2e2b0325e3d6d524c6801b7439d3aaea4520 (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 'src/include/fmgr.h')
-rw-r--r--src/include/fmgr.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/include/fmgr.h b/src/include/fmgr.h
index 2c05dfc134a..b5e7435828b 100644
--- a/src/include/fmgr.h
+++ b/src/include/fmgr.h
@@ -11,7 +11,7 @@
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/fmgr.h,v 1.63 2010/01/02 16:58:00 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/fmgr.h,v 1.64 2010/02/08 20:39:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -530,6 +530,20 @@ extern PGFunction lookup_external_function(void *filehandle, char *funcname);
extern void load_file(const char *filename, bool restricted);
extern void **find_rendezvous_variable(const char *varName);
+/*
+ * Support for aggregate functions
+ *
+ * This is actually in executor/nodeAgg.c, but we declare it here since the
+ * whole point is for callers of it to not be overly friendly with nodeAgg.
+ */
+
+/* AggCheckCallContext can return one of the following codes, or 0: */
+#define AGG_CONTEXT_AGGREGATE 1 /* regular aggregate */
+#define AGG_CONTEXT_WINDOW 2 /* window function */
+
+extern int AggCheckCallContext(FunctionCallInfo fcinfo,
+ MemoryContext *aggcontext);
+
/*
* !!! OLD INTERFACE !!!