1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-29 22:49:41 +03:00

Redesign API presented by nodeAgg.c for ordered-set and similar aggregates.

The previous design exposed the input and output ExprContexts of the
Agg plan node, but work on grouping sets has suggested that we'll regret
doing that.  Instead provide more narrowly-defined APIs that can be
implemented in multiple ways, namely a way to get a short-term memory
context and a way to register an aggregate shutdown callback.

Back-patch to 9.4 where the bad APIs were introduced, since we don't
want third-party code using these APIs and then having to change in 9.5.

Andrew Gierth
This commit is contained in:
Tom Lane
2014-07-03 18:25:33 -04:00
parent 8b6010b835
commit 6f5034eda0
3 changed files with 34 additions and 28 deletions

View File

@@ -23,7 +23,7 @@ typedef struct Node *fmNodePtr;
typedef struct Aggref *fmAggrefPtr;
/* Likewise, avoid including execnodes.h here */
typedef struct ExprContext *fmExprContextPtr;
typedef void (*fmExprContextCallbackFunction) (Datum arg);
/* Likewise, avoid including stringinfo.h here */
typedef struct StringInfoData *fmStringInfo;
@@ -656,8 +656,10 @@ extern void **find_rendezvous_variable(const char *varName);
extern int AggCheckCallContext(FunctionCallInfo fcinfo,
MemoryContext *aggcontext);
extern fmAggrefPtr AggGetAggref(FunctionCallInfo fcinfo);
extern fmExprContextPtr AggGetPerTupleEContext(FunctionCallInfo fcinfo);
extern fmExprContextPtr AggGetPerAggEContext(FunctionCallInfo fcinfo);
extern MemoryContext AggGetTempMemoryContext(FunctionCallInfo fcinfo);
extern void AggRegisterCallback(FunctionCallInfo fcinfo,
fmExprContextCallbackFunction func,
Datum arg);
/*
* We allow plugin modules to hook function entry/exit. This is intended