Re: [PATH] Jsonb, insert a new value into an array at arbitrary position - Mailing list pgsql-hackers

From Petr Jelinek
Subject Re: [PATH] Jsonb, insert a new value into an array at arbitrary position
Date
Msg-id 56D48FD5.8030703@2ndquadrant.com
Whole thread Raw
In response to Re: [PATH] Jsonb, insert a new value into an array at arbitrary position  (Dmitry Dolgov <9erthalion6@gmail.com>)
List pgsql-hackers
On 29/02/16 18:19, Dmitry Dolgov wrote:
>  > I'd strongly prefer the jsonb_array_insert naming though
>  > I don't think it's a good idea to use set when this is used on
> object, I think that we should throw error in that case.
>
> Well, I thought it's wrong to introduce different functions and
> behaviour patterns for objects and arrays, because it's the one data
> type after all. But it's just my opinion of course.
>

The problem I see with that logic is because we don't keep order of keys 
in the jsonb object the "insert" in the name will have misleading 
implications from the point of the user. Also it does not do anything 
for object that "set" doesn't do already, so why have two interfaces for 
doing same thing.

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



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: pg_dump / copy bugs with "big lines" ?
Next
From: Fabrízio de Royes Mello
Date:
Subject: Re: Publish autovacuum informations