Re: [HACKERS] jsonb_delete with arrays
От | Michael Paquier |
---|---|
Тема | Re: [HACKERS] jsonb_delete with arrays |
Дата | |
Msg-id | CAB7nPqRgR1fRVDMePN28XkqwqhACZRukHBYzqQ1x8ZBnhAOtJg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: [HACKERS] jsonb_delete with arrays (Dmitry Dolgov <9erthalion6@gmail.com>) |
Ответы |
Re: [HACKERS] jsonb_delete with arrays
|
Список | pgsql-hackers |
On Sun, Dec 18, 2016 at 1:27 AM, Dmitry Dolgov <9erthalion6@gmail.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
В списке pgsql-hackers по дате отправления: