Re: jsonb and nested hstore - Mailing list pgsql-hackers

From Merlin Moncure
Subject Re: jsonb and nested hstore
Date
Msg-id CAHyXU0yEKOGdJ2kb0=GYA=Puw9RwDJ4_6B9CbuvyaBwxRfyC_A@mail.gmail.com
Whole thread Raw
In response to Re: jsonb and nested hstore  (Josh Berkus <josh@agliodbs.com>)
List pgsql-hackers
On Wed, Feb 26, 2014 at 11:41 AM, Josh Berkus <josh@agliodbs.com> wrote:
> On 02/26/2014 07:02 AM, Merlin Moncure wrote:
>> On Tue, Feb 25, 2014 at 3:57 PM, Hannu Krosing <hannu@2ndquadrant.com> wrote:
>>> It is not in any specs, but nevertheless all major imlementations do it and
>>> some code depends on it.
>>> IIRC, this behaviour is currently also met only by json and not by jsonb.
>>
>> Yes: This was the agreement that was struck and is the main reason why
>> there are two json types, not one.  JSON does not guarantee field
>> ordering as I read the spec and for the binary form ordering is not
>> maintained as a concession to using the hstore implementation.
>
> Actually, that's not true; neither Mongo/BSON nor CouchDB preserve field
> ordering.  So users who are familiar with JSONish data *storage* should
> be aware that field ordering is not preserved.

right (although I'm not sure what wasn't true there).  I think the
status quo is fine; If you have to have the document precisely
preserved for whatever reason you can do that -- you just have to be
prepared to give up some things.  As noted in the other thread
serialization is more interesting but that also works fine.  The
breakdown in terms of usage between json/jsonb to me is very clear
(json will handle serialization/deserializaton heavy patterns and a
few edge cases for storage).   The split between json and jsonb in
hindsight made a lot of sense.

What is not going to be so clear for users (particularly without good
supporting documentation) is how things break down in terms of usage
between hstore and jsonb.

merlin



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: [PATCH] Use MAP_HUGETLB where supported (v3)
Next
From: Josh Berkus
Date:
Subject: Re: jsonb and nested hstore