Re: [PATH] Jsonb, insert a new value into an array at arbitrary position

From: Petr Jelinek <petr(at)2ndquadrant(dot)com>
To: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATH] Jsonb, insert a new value into an array at arbitrary position
Date: 2016-02-29 18:37:09
Message-ID: 56D48FD5.8030703@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabrízio de Royes Mello 2016-02-29 19:20:28 Re: Publish autovacuum informations
Previous Message Alvaro Herrera 2016-02-29 18:30:23 Re: pg_dump / copy bugs with "big lines" ?