Re: BUG #8398: to_json(''::hstore) gives invalid JSON - Mailing list pgsql-bugs

From Bruce Momjian
Subject Re: BUG #8398: to_json(''::hstore) gives invalid JSON
Date
Msg-id 20140131234139.GE19957@momjian.us
Whole thread Raw
In response to BUG #8398: to_json(''::hstore) gives invalid JSON  (martin.kevin@gmail.com)
Responses Re: BUG #8398: to_json(''::hstore) gives invalid JSON
List pgsql-bugs
On Mon, Aug 26, 2013 at 06:00:37PM +0000, martin.kevin@gmail.com wrote:
> The following bug has been logged on the website:
>
> Bug reference:      8398
> Logged by:          Kevin Martin
> Email address:      martin.kevin@gmail.com
> PostgreSQL version: 9.3rc1
> Operating system:   Ubuntu 10.04
> Description:
>
> to_json() returns an invalid JSON value when called on an empty hstore
> value. The first two statements below behave as expected, the third (with an
> empty hstore) fails:
>
>
> config_test=# SELECT to_json(q) FROM (SELECT '' AS v) AS q;
>  to_json
> ----------
>  {"v":""}
> (1 row)
>
>
> config_test=# SELECT to_json(q) FROM (SELECT ARRAY[]::INT[] AS v) AS q;
>  to_json
> ----------
>  {"v":[]}
> (1 row)
>
>
> config_test=# SELECT to_json(q) FROM (SELECT ''::HSTORE AS v) AS q;
>  to_json
> ---------
>  {"v":}
> (1 row)

I see different/better(?) output in git head:

    SELECT to_json(q) FROM (SELECT ''::HSTORE AS v) AS q;
     to_json
    ----------
     {"v":{}}
    (1 row)

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + Everyone has their own god. +

pgsql-bugs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: BUG #8395: empty aclitem arrays are considered 1-dimensional
Next
From: Bruce Momjian
Date:
Subject: Re: BUG #8399: inconsistent input of multidimensional arrays