Re: BUG #9519: Allows storing scalar json, but fails when querying

From: Christian Kruse <christian(at)2ndQuadrant(dot)com>
To: David Johnston <polobo(at)yahoo(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #9519: Allows storing scalar json, but fails when querying
Date: 2014-03-11 07:50:30
Message-ID: 20140311075030.GC9524@defunct.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 warn
> 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,

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alf Kristian Støyle 2014-03-11 08:32:58 Re: BUG #9519: Allows storing scalar json, but fails when querying
Previous Message Jeff Janes 2014-03-10 21:42:59 Re: BUG #9519: Allows storing scalar json, but fails when querying