From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: "David E(dot) Wheeler" <david(at)justatheory(dot)com>, PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: JSON NULLs
Date: 2013-02-08 14:15:59
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 02/06/2013 02:36 PM, Andrew Dunstan wrote:
> On 02/06/2013 02:24 PM, Merlin Moncure wrote:
>> On Wed, Feb 6, 2013 at 1:08 PM, David E. Wheeler
>> <david(at)justatheory(dot)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 tell the
>>> 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)
> Probably. I'm on it.

Revised patch attached. The problem also existed with the get*_as_text
functions (and their operators). Some additional regression tests are
added to test these cases.



Attachment Content-Type Size
jsonapi8.patch text/x-patch 138.3 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2013-02-08 14:21:38 Re: [JDBC] JPA + enum == Exception
Previous Message Kohei KaiGai 2013-02-08 13:51:40 Re: sepgsql and materialized views