Content-Length: 286479 | pFad | http://github.com/postgrespro/postgres/commit/bbe4deac1b98594206a024c9e91d664b3c3410d9

EB Return valid json when converting an empty hstore. · postgrespro/postgres@bbe4dea · GitHub
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)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/bbe4deac1b98594206a024c9e91d664b3c3410d9

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy