Re: [HACKERS] jsonb_delete with arrays - Mailing list pgsql-hackers

From Dmitry Dolgov
Subject Re: [HACKERS] jsonb_delete with arrays
Date
Msg-id CA+q6zcUb3YkLqKn5CLGbepo4PJScFVLKBNWOG2ewhU6X+wRW5w@mail.gmail.com
Whole thread Raw
In response to Re: jsonb_delete with arrays  (Magnus Hagander <magnus@hagander.net>)
Responses Re: [HACKERS] jsonb_delete with arrays  (Michael Paquier <michael.paquier@gmail.com>)
List pgsql-hackers
Attached is an implantation of jsonb_delete that instead of taking a single key to remove accepts an array of keys

Since I already saw this patch, here is my small review.

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.

* 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}')`.

I've attached a patch with these modifications. What do you think?
Attachment

pgsql-hackers by date:

Previous
From: Dean Rasheed
Date:
Subject: [HACKERS] CREATE OR REPLACE VIEW bug
Next
From: Steve Singer
Date:
Subject: Re: [HACKERS] Logical Replication WIP