Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
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

+2-10
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)