1
0
mirror of https://github.com/postgres/postgres.git synced 2025-04-21 12:05:57 +03:00

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().
This commit is contained in:
Andrew Dunstan 2014-09-25 08:18:18 -04:00
parent b0d81adea6
commit ecacbdbcee

View File

@ -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, " }");