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+q6zcWmzEdwYa8Hao2NxGn2LAGnUs38b_zPtW-8n6iqKPzEjw@mail.gmail.com
Whole thread Raw
In response to Re: [PATH] Jsonb, insert a new value into an array at arbitrary position  (David Steele <david@pgmasters.net>)
Responses Re: [PATH] Jsonb, insert a new value into an array at arbitrary position  (Petr Jelinek <petr@2ndquadrant.com>)
Re: [PATH] Jsonb, insert a new value into an array at arbitrary position  (Vitaly Burovoy <vitaly.burovoy@gmail.com>)
List pgsql-hackers
Hi Vitaly, thanks for the review. I've attached a new version of path with improvements. Few notes:

> 7. Why did you remove "skip"? It is a comment what "true" means...

Actually, I thought that this comment was about skipping an element from jsonb in order to change/delete it,
not about the last argument.  E.g. you can find several occurrences of `JsonbIteratorNext` with `true` as the last
argument but without a "last argument is about skip" comment.
And there is a piece of code in the function `jsonb_delete` with a "skip element" commentary:

```
/* skip corresponding value as well */
if (r == WJB_KEY)
    JsonbIteratorNext(&it, &v, true);
```

So since in this patch it's not a simple skipping for setPathArray, I removed that commentary. Am I wrong?

> 9. And finally... it does not work as expected in case of:

Yes, good catch, thanks.
Attachment

pgsql-hackers by date:

Previous
From: Craig Ringer
Date:
Subject: Re: TAP / recovery-test fs-level backups, psql enhancements etc
Next
From: Michael Paquier
Date:
Subject: Re: IF (NOT) EXISTS in psql-completion