Re: BUG #8398: to_json(''::hstore) gives invalid JSON

From: Kevin Martin <martin(dot)kevin(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #8398: to_json(''::hstore) gives invalid JSON
Date: 2014-02-01 19:08:28
Message-ID: CAA3D3J54qKaf+RzZ0OcRMpF_Cj9gBLNvn9Deru_4PjmoZi4iZg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I cannot confirm the fix right now but if that's the output then I'd say
the issue must have been resolved. As long as that valid, empty object,
JSON comes out instead of an empty value I think this has been handled.

On Fri, Jan 31, 2014 at 6:41 PM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:

> On Mon, Aug 26, 2013 at 06:00:37PM +0000, martin(dot)kevin(at)gmail(dot)com wrote:
> > The following bug has been logged on the website:
> >
> > Bug reference: 8398
> > Logged by: Kevin Martin
> > Email address: martin(dot)kevin(at)gmail(dot)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(at)momjian(dot)us> http://momjian.us
> EnterpriseDB http://enterprisedb.com
>
> + Everyone has their own god. +
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Paul Watson 2014-02-01 20:14:21
Previous Message targen 2014-02-01 18:41:47 BUG #9068: invalid YY_START on Unicode identifier escape syntax