Re: jsonb array-style subscripting

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>
Cc: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: jsonb array-style subscripting
Date: 2015-08-18 13:45:36
Message-ID: 55D33700.501@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 08/18/2015 01:32 AM, Pavel Stehule wrote:
> Hi
>
> 2015-08-17 21:12 GMT+02:00 Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com
> <mailto:Jim(dot)Nasby(at)bluetreble(dot)com>>:
>
> On 8/17/15 12:57 PM, Dmitry Dolgov wrote:
>
> * is it interesting for the community?
>
>
> We definitely need better ways to manipulate JSON.
>
> * is that a good idea to extend the `ArrayRef` for jsonb? If it's
> appropriate, probably we can rename it to `ArrayJsonbRef` of
> something.
> * what can be improved in the code at the top level (function
> placement,
> probably, functionality duplication, etc.)?
> * are there any special cases, that I should take care of in this
> implementation?
>
>
> How would this work when you have a JSON array? Postgres array
> syntax suddenly becoming key/value syntax for JSON seems like a
> pretty bad idea to me. Could a different syntax (maybe {}) be used
> instead?
>
>
> I don't understand why '{}' should be better than '[]' ?
>
> The lot of modern languages doesn't different between arrays and hash.
>
>

What is more, it would be a lot more intrusive to the parser, I suspect.
We currently allow json path expressions to contain both object key and
array index values, and I don't see any reason to do this differently.
This is the syntax that was discussed at pgcon.

cheers

andrew

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-08-18 13:50:52 Re: allowing wal_level change at run time
Previous Message David Fetter 2015-08-18 13:43:23 Re: Declarative partitioning