Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit bda1d14

Browse files
committed
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().
1 parent 54b8ed6 commit bda1d14

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/utils/adt/json.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1973,7 +1973,7 @@ json_object_agg_finalfn(PG_FUNCTION_ARGS)
19731973
state = PG_ARGISNULL(0) ? NULL : (StringInfo) PG_GETARG_POINTER(0);
19741974

19751975
if (state == NULL)
1976-
PG_RETURN_TEXT_P(cstring_to_text("{}"));
1976+
PG_RETURN_NULL();
19771977

19781978
appendStringInfoString(state, " }");
19791979

0 commit comments

Comments
 (0)