ArrayBuildState *state;
int dims[1];
int lbs[1];
+ MemoryContext aggcontext;
/* cannot be called directly because of internal-type argument */
- Assert(AggCheckCallContext(fcinfo, NULL));
+ if (!AggCheckCallContext(fcinfo, &aggcontext))
+ elog(ERROR, "aggregate function called in non-aggregate context");
state = PG_ARGISNULL(0) ? NULL : (ArrayBuildState *) PG_GETARG_POINTER(0);
{
Datum result;
ArrayBuildStateArr *state;
+ MemoryContext aggcontext;
/* cannot be called directly because of internal-type argument */
- Assert(AggCheckCallContext(fcinfo, NULL));
+ if (!AggCheckCallContext(fcinfo, &aggcontext))
+ elog(ERROR, "aggregate function called in non-aggregate context");
state = PG_ARGISNULL(0) ? NULL : (ArrayBuildStateArr *) PG_GETARG_POINTER(0);
elog(ERROR, "json_agg_collectfn called in non-aggregate context");
}
-
- /* cannot be called directly because of internal-type argument */
- Assert(AggCheckCallContext(fcinfo, NULL));
-
if (PG_ARGISNULL(0))
{
/*
json_agg_finalfn(PG_FUNCTION_ARGS)
{
JsonAggState *state;
+ MemoryContext aggcontext;
/* cannot be called directly because of internal-type argument */
- Assert(AggCheckCallContext(fcinfo, NULL));
+ if (!AggCheckCallContext(fcinfo, &aggcontext))
+ elog(ERROR, "aggregate function called in non-aggregate context");
state = PG_ARGISNULL(0) ?
NULL :
json_object_agg_finalfn(PG_FUNCTION_ARGS)
{
JsonAggState *state;
+ MemoryContext aggcontext;
/* cannot be called directly because of internal-type argument */
- Assert(AggCheckCallContext(fcinfo, NULL));
+ if (!AggCheckCallContext(fcinfo, &aggcontext))
+ elog(ERROR, "aggregate function called in non-aggregate context");
state = PG_ARGISNULL(0) ? NULL : (JsonAggState *) PG_GETARG_POINTER(0);
JsonbAggState *arg;
JsonbInState result;
Jsonb *out;
+ MemoryContext aggcontext;
/* cannot be called directly because of internal-type argument */
- Assert(AggCheckCallContext(fcinfo, NULL));
+ if (!AggCheckCallContext(fcinfo, &aggcontext))
+ elog(ERROR, "jsonb_agg_finalfn called in non-aggregate context");
if (PG_ARGISNULL(0))
PG_RETURN_NULL(); /* returns null iff no input values */
JsonbAggState *arg;
JsonbInState result;
Jsonb *out;
+ MemoryContext aggcontext;
/* cannot be called directly because of internal-type argument */
- Assert(AggCheckCallContext(fcinfo, NULL));
+ if (!AggCheckCallContext(fcinfo, &aggcontext))
+ elog(ERROR, "jsonb_object_agg_finalfn called in non-aggregate context");
if (PG_ARGISNULL(0))
PG_RETURN_NULL(); /* returns null iff no input values */
bytea_string_agg_finalfn(PG_FUNCTION_ARGS)
{
StringInfo state;
+ MemoryContext aggcontext;
/* cannot be called directly because of internal-type argument */
- Assert(AggCheckCallContext(fcinfo, NULL));
+ if (!AggCheckCallContext(fcinfo, &aggcontext))
+ {
+ /* cannot be called directly because of internal-type argument */
+ elog(ERROR, "bytea_string_agg_finalfn called in non-aggregate context");
+ }
state = PG_ARGISNULL(0) ? NULL : (StringInfo) PG_GETARG_POINTER(0);
string_agg_finalfn(PG_FUNCTION_ARGS)
{
StringInfo state;
+ MemoryContext aggcontext;
- /* cannot be called directly because of internal-type argument */
- Assert(AggCheckCallContext(fcinfo, NULL));
+ if (!AggCheckCallContext(fcinfo, &aggcontext))
+ {
+ /* cannot be called directly because of internal-type argument */
+ elog(ERROR, "string_agg_finalfn called in non-aggregate context");
+ }
state = PG_ARGISNULL(0) ? NULL : (StringInfo) PG_GETARG_POINTER(0);
extern Datum to_json(PG_FUNCTION_ARGS);
extern Datum json_agg_transfn(PG_FUNCTION_ARGS);
+#ifdef XCP
+extern Datum json_agg_collectfn(PG_FUNCTION_ARGS);
+#endif
extern Datum json_agg_finalfn(PG_FUNCTION_ARGS);
extern Datum json_object_agg_finalfn(PG_FUNCTION_ARGS);