Re: JSON NULLs - Mailing list pgsql-hackers

From Merlin Moncure
Subject Re: JSON NULLs
Date
Msg-id CAHyXU0z68dOLCta-Cg0MyDt1pJ2dDc4Ei_fV7MfR8VOr-CfUgQ@mail.gmail.com
Whole thread Raw
In response to JSON NULLs  ("David E. Wheeler" <david@justatheory.com>)
Responses Re: JSON NULLs
List pgsql-hackers
On Wed, Feb 6, 2013 at 1:08 PM, David E. Wheeler <david@justatheory.com> wrote:
> Hackers,
>
> While playing with Andrew’s JSON enhancements, I noticed this:
>
>     david=# select * From json_each_as_text('{"baz": null}'::json);
>      key | value
>     -----+-------
>      baz | null
>
> It is returning 'null'::text there, not NULL::text. I had expected the latter, because otherwise it's not possible to
tellthe difference between '{"foo": null}' and '{"foo": "null"}'. 

IMO, this is bug in proposed implementation.  json unquoted null
should not map to string 'null' but to SQL,  casting behavior from
text as implemented looks correct. (only SQL null should produce json
null)

merlin



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: palloc unification
Next
From: Andrew Dunstan
Date:
Subject: Re: JSON NULLs