diff options
| author | Andrew Dunstan | 2014-09-25 12:18:18 +0000 |
|---|---|---|
| committer | Andrew Dunstan | 2014-09-25 12:19:44 +0000 |
| commit | bda1d14360404ef58c4647888032158991051b14 (patch) | |
| tree | 7a338a041d45ad6e9ef8f60ce9109a15a98bf7dc | |
| parent | 54b8ed6c24736d7ad55f56dbaa2696ae05c4bded (diff) | |
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().
| -rw-r--r-- | src/backend/utils/adt/json.c | 2 |
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, " }"); |
