From: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
---|---|
To: | Dmitry Dolgov <9erthalion6(at)gmail(dot)com> |
Cc: | Magnus Hagander <magnus(at)hagander(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: jsonb_delete with arrays |
Date: | 2017-01-17 07:25:41 |
Message-ID: | CAB7nPqRgR1fRVDMePN28XkqwqhACZRukHBYzqQ1x8ZBnhAOtJg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sun, Dec 18, 2016 at 1:27 AM, Dmitry Dolgov <9erthalion6(at)gmail(dot)com> wrote:
> Speaking about implementation of `jsonb_delete_array` - it's fine, but I
> would like to suggest two modifications:
>
> * create a separate helper function for jsonb delete operation, to use it in
> both `jsonb_delete` and `jsonb_delete_array`. It will help to concentrate
> related logic in one place.
I am not sure that it is much a win as the code loses readability for
a minimal refactoring. What would have been nice is to group as well
jsonb_delete_idx but handling of the element deletion is really
different there.
> * use variadic arguments for `jsonb_delete_array`. For rare cases, when
> someone decides to use this function directly instead of corresponding
> operator. It will be more consistent with `jsonb_delete` from my point of
> view, because it's transition from `jsonb_delete(data, 'key')` to
> `jsonb_delete(data, 'key1', 'key2')` is more smooth, than to
> `jsonb_delete(data, '{key1, key2}')`.
That's a good idea.
> I've attached a patch with these modifications. What do you think?
Looking at both patches proposed, documentation is still missing in
the list of jsonb operators as '-' is missing for arrays. I am marking
this patch as waiting on author for now.
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2017-01-17 07:31:00 | Re: Renaming of pg_xlog and pg_clog |
Previous Message | Beena Emerson | 2017-01-17 07:20:37 | Re: increasing the default WAL segment size |