Re: BUG #9519: Allows storing scalar json, but fails when querying - Mailing list pgsql-bugs

From Christian Kruse
Subject Re: BUG #9519: Allows storing scalar json, but fails when querying
Date
Msg-id 20140311075030.GC9524@defunct.ch
Whole thread Raw
In response to Re: BUG #9519: Allows storing scalar json, but fails when querying  (David Johnston <polobo@yahoo.com>)
Responses Re: BUG #9519: Allows storing scalar json, but fails when querying  (David Johnston <polobo@yahoo.com>)
List pgsql-bugs
Hi,

On 10/03/14 14:09, David Johnston wrote:

> The system supposes that, at a structural level, you are dealing with
> column-consistent data and so if you ask for something that does not make
> sense (i.e., an object key when you have an array or a scalar) it will wa=
rn
> you.

Looking at the common usage of JSON it doesn't seem to be a good idea
to imply column-consistent JSON. Normally when JSON is used the
application ensures consistency and when a non-existent key is
accessed NULL is returned. I think this is expected behavior and we
should do it like that, too; if one wants it different, he should use
CHECK constraints.

Best regards,

--=20
 Christian Kruse               http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

pgsql-bugs by date:

Previous
From: Jeff Janes
Date:
Subject: Re: BUG #9519: Allows storing scalar json, but fails when querying
Next
From: Alf Kristian Støyle
Date:
Subject: Re: BUG #9519: Allows storing scalar json, but fails when querying