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

From Dmitry Dolgov
Subject Re: [PATH] Jsonb, insert a new value into an array at arbitrary position
Date
Msg-id CA+q6zcW9PJc_NSQYnfaSuFfd+_y9o34SuV8BuTYAxOrgiJddLg@mail.gmail.com
Whole thread Raw
In response to Re: [PATH] Jsonb, insert a new value into an array at arbitrary position  (Vitaly Burovoy <vitaly.burovoy@gmail.com>)
Responses Re: [PATH] Jsonb, insert a new value into an array at arbitrary position  (Vitaly Burovoy <vitaly.burovoy@gmail.com>)
Re: [PATH] Jsonb, insert a new value into an array at arbitrary position  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
On 31 March 2016 at 17:31, Vitaly Burovoy <vitaly.burovoy@gmail.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

pgsql-hackers by date:

Previous
From: Kyotaro HORIGUCHI
Date:
Subject: Re: PATCH: index-only scans with partial indexes
Next
From: Dilip Kumar
Date:
Subject: Re: Relation extension scalability