diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2013-10-17 11:09:55 -0400 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2013-10-17 11:09:55 -0400 |
commit | bfb327ac1d9a55fe0cd83fa96d4ba471dd30efaf (patch) | |
tree | 53e41db8b2e5a3e21be08111848f6023d664ee46 | |
parent | 41b46ed8a269e502f95c54fc30280ef9464d9d18 (diff) | |
download | postgresql-bfb327ac1d9a55fe0cd83fa96d4ba471dd30efaf.tar.gz postgresql-bfb327ac1d9a55fe0cd83fa96d4ba471dd30efaf.zip |
Return valid json when converting an empty hstore.
Oskari Saarenmaa.
-rw-r--r-- | contrib/hstore/hstore_io.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/contrib/hstore/hstore_io.c b/contrib/hstore/hstore_io.c index d3e67dd5d02..772a5ca5d51 100644 --- a/contrib/hstore/hstore_io.c +++ b/contrib/hstore/hstore_io.c @@ -1240,11 +1240,7 @@ hstore_to_json_loose(PG_FUNCTION_ARGS) dst; if (count == 0) - { - out = palloc(1); - *out = '\0'; - PG_RETURN_TEXT_P(cstring_to_text(out)); - } + PG_RETURN_TEXT_P(cstring_to_text_with_len("{}",2)); buflen = 3; @@ -1369,11 +1365,7 @@ hstore_to_json(PG_FUNCTION_ARGS) dst; if (count == 0) - { - out = palloc(1); - *out = '\0'; - PG_RETURN_TEXT_P(cstring_to_text(out)); - } + PG_RETURN_TEXT_P(cstring_to_text_with_len("{}",2)); buflen = 3; |