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

From Andrew Dunstan
Subject Re: jsonb and nested hstore
Date
Msg-id 5310A218.2080604@dunslane.net
Whole thread Raw
In response to Re: jsonb and nested hstore  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On 02/28/2014 09:27 AM, Robert Haas wrote:
> On Thu, Feb 27, 2014 at 8:55 PM, Christophe Pettus <xof@thebuild.com> wrote:
>> On Feb 27, 2014, at 5:31 PM, Peter Geoghegan <pg@heroku.com> wrote:
>>> Now, it's confusing that it has to go through hstore, perhaps, but
>>> that's hardly all that bad in and of itself.
>> Yes, it is.  It strikes me as irrational to have jsonb depend on hstore.  Let's be honest with ourselves: if we were
startingover, we wouldn't start by creating our own proprietary hierarchical type and then making the hierarchical type
everyoneelse uses depend on it.  hstore exists because json didn't.  But json does now, and we shouldn't create a jsonb
dependencyon hstore.
 
> Right.  I think this is one of the smartest things that anyone has
> said on this thread.  I don't have any objection to the idea of
> enhancing hstore to support hierarchical data; I completely understand
> the appeal of such a change.  Nor do I have any objection to the idea
> of a binary-json type in core (or out of core); there are obvious uses
> for such a thing.
>
> But what's happened here is not the sum of those two admirable
> proposals.  hstore has been augmented not only to support hierarchical
> data but also with a notion of typed data that matches that of JSON
> (except that I think the hstore and jsonb patches may have slightly
> different notions as to what constitutes a valid number).  The
> internal format for jsonb has been contrived to match the
> upward-compatible format designed for JSON.  And thus jsonb depends on
> hstore for the functionality that it isn't able to provide for itself.
>
> Taken individually, none of those decisions seem crazy, but taken
> together it's pretty weird.  Instead of inventing a new type (jsonb)
> designed from the ground up to do what we want, we're, well, we're
> doing what Christophe says: creating our own proprietary hierarchical
> type and then making the hierarchical type everyone else uses depend
> on it.  Described in those terms, it's hard for me to believe that
> anyone here thinks that's not a strange thing to do.
>


Well, the time to make these sorts of decisions would have been back in 
November. The direction was clear then, if you were paying attention. 
But right from the time this came up at pgcon the idea was to leverage 
Oleg and Teodor's work. Nobody found it strange then. I'm rather 
confused about why it's suddenly strange now.

What you're essentially arguing for is the invention of TWO binary 
treeish things, without any argument I have yet seen advanced about why 
the first one we have is good enough for hstore but not good enough for 
jsonb.

Frankly, it looks to me like you have turned Christophe's argument on 
its head, or completely misunderstood his point.

cheers

andrew




pgsql-hackers by date:

Previous
From: Emre Hasegeli
Date:
Subject: Re: GiST support for inet datatypes
Next
From: Stephen Frost
Date:
Subject: Re: jsonb and nested hstore