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

From: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
To: Vitaly Burovoy <vitaly(dot)burovoy(at)gmail(dot)com>
Cc: David Steele <david(at)pgmasters(dot)net>, Petr Jelinek <petr(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATH] Jsonb, insert a new value into an array at arbitrary position
Date: 2016-03-31 13:00:58
Message-ID: CA+q6zcW9PJc_NSQYnfaSuFfd+_y9o34SuV8BuTYAxOrgiJddLg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 31 March 2016 at 17:31, Vitaly Burovoy <vitaly(dot)burovoy(at)gmail(dot)com> wrote:

> it is logical to insert new value if "before", then current value, then new
> value if "after".
>

Oh, I see now. There is a slightly different logic: `v` is a current value
and `newval` is a new value.
So basically we insert a current item in case of "after", then a new value
(if it's not a delete operation),
then a current item in case of "before". But I agree, this code can be more
straightforward. I've attached
a new version, pls take a look (it contains the same logic that you've
mentioned).

Attachment Content-Type Size
jsonb_insert_v6.patch text/x-patch 19.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2016-03-31 13:03:45 Re: Relation extension scalability
Previous Message Kyotaro HORIGUCHI 2016-03-31 12:53:58 Re: PATCH: index-only scans with partial indexes