Return NULL from json_object_agg if it gets no rows.

This makes it consistent with the docs and with all other builtin
aggregates apart from count().
pull/14/head
Andrew Dunstan 11 years ago
parent b0d81adea6
commit ecacbdbcee
  1. 2
      src/backend/utils/adt/json.c

@ -1948,7 +1948,7 @@ json_object_agg_finalfn(PG_FUNCTION_ARGS)
state = PG_ARGISNULL(0) ? NULL : (StringInfo) PG_GETARG_POINTER(0);
if (state == NULL)
PG_RETURN_TEXT_P(cstring_to_text("{}"));
PG_RETURN_NULL();
appendStringInfoString(state, " }");

Loading…
Cancel
Save