summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/json.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/adt/json.c')
-rw-r--r--src/backend/utils/adt/json.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/backend/utils/adt/json.c b/src/backend/utils/adt/json.c
index d8ae7d3985..773ace3c7b 100644
--- a/src/backend/utils/adt/json.c
+++ b/src/backend/utils/adt/json.c
@@ -1961,10 +1961,6 @@ json_agg_collectfn(PG_FUNCTION_ARGS)
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))
{
/*
@@ -2013,11 +2009,12 @@ json_agg_collectfn(PG_FUNCTION_ARGS)
Datum
json_agg_finalfn(PG_FUNCTION_ARGS)
{
- JsonAggState *state;
+ 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 :
@@ -2130,11 +2127,12 @@ json_object_agg_transfn(PG_FUNCTION_ARGS)
Datum
json_object_agg_finalfn(PG_FUNCTION_ARGS)
{
- JsonAggState *state;
+ 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);