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

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Oskari Saarenmaa <os(at)ohmu(dot)fi>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] hstore_to_json: empty hstores must return empty json objects
Date: 2013-10-17 14:23:20
Message-ID: 20131017142320.GE9746@eldon.alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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("{}")) ?

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Oskari Saarenmaa 2013-10-17 14:37:12 Re: [PATCH] hstore_to_json: empty hstores must return empty json objects
Previous Message Peter Eisentraut 2013-10-17 14:15:38 Re: [PATCH] pg_sleep(interval)