aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/json.c
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2014-09-25 08:18:18 -0400
committerAndrew Dunstan <andrew@dunslane.net>2014-09-25 08:19:44 -0400
commitbda1d14360404ef58c4647888032158991051b14 (patch)
tree7a338a041d45ad6e9ef8f60ce9109a15a98bf7dc /src/backend/utils/adt/json.c
parent54b8ed6c24736d7ad55f56dbaa2696ae05c4bded (diff)
downloadpostgresql-bda1d14360404ef58c4647888032158991051b14.tar.gz
postgresql-bda1d14360404ef58c4647888032158991051b14.zip
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().
Diffstat (limited to 'src/backend/utils/adt/json.c')
-rw-r--r--src/backend/utils/adt/json.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/utils/adt/json.c b/src/backend/utils/adt/json.c
index 494a0285267..1820029fe95 100644
--- a/src/backend/utils/adt/json.c
+++ b/src/backend/utils/adt/json.c
@@ -1973,7 +1973,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, " }");