Re: additional json functionality

From: Hannu Krosing <hannu(at)2ndQuadrant(dot)com>
To: "David E(dot) Wheeler" <david(at)justatheory(dot)com>, Hannu Krosing <hannu(at)2ndquadrant(dot)com>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: additional json functionality
Date: 2013-11-17 22:01:27
Message-ID: 52893CB7.6020901@2ndQuadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11/17/2013 09:02 PM, David E. Wheeler wrote:
> On Nov 16, 2013, at 2:04 PM, Hannu Krosing <hannu(at)2ndquadrant(dot)com> wrote:
>
>>> It’s still input and output as JSON, though.
>> Yes, because JavaScript Object Notation *is* a serialization format
>> (aka Notation) for converting JavaScript Objects to text format
>> and back :)
>>> I still like JSONB best.
>> To me it feels redundant, like binarytextbinary
>>
>> the binary representation of JSON is JavaScript(-like) Object, not
>> "binary json"
>>
>> So my vote would be either jsobj or jsdoc (as "document databases") tend
>> to call the structured types "documents"
> You know that both types support scalar values right?
> 'a'::JSON works now,
Yeah, and I remember all the bikeshedding about how
scalars should not be supported as they are
"not really JSON" by standard ...

At that time I was also quite vocal about not painting
ourselves in corner by not normalising json on input and
thus generating a backwards compatibility problem in
case we would ever get "proper" json support.
> and 'a'::hstore works with the WIP patch. For that reason I would not think that "doc" or "obj" would be good choices.
this is like claiming that text should not be text because you
can store a single character there as well.

I feel that both "doc" and "obj" convey the meaning that it is a
structured type meant for fast component lookup as opposed to
jsoN(otation) type which is text.

Also jsdoc/jsobj would be a natural bridge to pgdoc/pgobj which would be
similar to "new json" but allow any type supported by postgresql as a value.

(... and in several languages even scalars really are objects)
>
> I like JSONB because:
>
> 1. The "B" means "binary"
"Binary" has really little to do with the fact that we
normalise on input, which is the real significant feature
of the new json type.
> 2. The "B" means "second"
Why not just json2 , (you know, like varchar2 in a certain other database ;)
> 3. It's short
jsobj and jsdoc are exactly as short as jsonb
> 4. See also BYTEA.
BYTEA is "byte array", so not really relevant.

(unless you try to rhyme a byte-a, json-b sequence ;) )

Cheers

--
Hannu Krosing
PostgreSQL Consultant
Performance, Scalability and High Availability
2ndQuadrant Nordic OÜ

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2013-11-17 22:10:32 Re: Assertions in PL/PgSQL
Previous Message Dimitri Fontaine 2013-11-17 21:51:31 Re: additional json functionality