Skip to content

Commit bbe4dea

Browse files
committed
Return valid json when converting an empty hstore.
Oskari Saarenmaa.
1 parent 86029b3 commit bbe4dea

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

contrib/hstore/hstore_io.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,11 +1240,7 @@ hstore_to_json_loose(PG_FUNCTION_ARGS)
12401240
dst;
12411241

12421242
if (count == 0)
1243-
{
1244-
out = palloc(1);
1245-
*out = '\0';
1246-
PG_RETURN_TEXT_P(cstring_to_text(out));
1247-
}
1243+
PG_RETURN_TEXT_P(cstring_to_text_with_len("{}",2));
12481244

12491245
buflen = 3;
12501246

@@ -1369,11 +1365,7 @@ hstore_to_json(PG_FUNCTION_ARGS)
13691365
dst;
13701366

13711367
if (count == 0)
1372-
{
1373-
out = palloc(1);
1374-
*out = '\0';
1375-
PG_RETURN_TEXT_P(cstring_to_text(out));
1376-
}
1368+
PG_RETURN_TEXT_P(cstring_to_text_with_len("{}",2));
13771369

13781370
buflen = 3;
13791371

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy