Re: [PATCH] hstore_to_json: empty hstores must return empty json objects

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Oskari Saarenmaa <os(at)ohmu(dot)fi>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] hstore_to_json: empty hstores must return empty json objects
Date: 2013-10-17 14:43:32
Message-ID: 525FF794.9010405@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 10/17/2013 10:23 AM, Alvaro Herrera wrote:
> Oskari Saarenmaa wrote:
>
>> @@ -1241,8 +1241,8 @@ hstore_to_json_loose(PG_FUNCTION_ARGS)
>>
>> if (count == 0)
>> {
>> - out = palloc(1);
>> - *out = '\0';
>> + out = palloc(3);
>> + memcpy(out, "{}", 3);
>> PG_RETURN_TEXT_P(cstring_to_text(out));
>> }
> Can't you just PG_RETURN_TEXT_P(cstring_to_text("{}")) ?
>

Yeah. I'm going to fix this this morning.

cheers

andrew

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2013-10-17 15:42:46 Re: [COMMITTERS] pgsql: Rework SSL renegotiation code
Previous Message Oskari Saarenmaa 2013-10-17 14:37:12 Re: [PATCH] hstore_to_json: empty hstores must return empty json objects