From: | Dmitry Dolgov <9erthalion6(at)gmail(dot)com> |
---|---|
To: | Magnus Hagander <magnus(at)hagander(dot)net> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: jsonb_delete with arrays |
Date: | 2016-12-17 16:27:42 |
Message-ID: | CA+q6zcUb3YkLqKn5CLGbepo4PJScFVLKBNWOG2ewhU6X+wRW5w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 | Content-Type | Size |
---|---|---|
jsonb_delete_worker.patch | text/x-patch | 7.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Steve Singer | 2016-12-17 17:34:32 | Re: Logical Replication WIP |
Previous Message | Dean Rasheed | 2016-12-17 15:42:20 | CREATE OR REPLACE VIEW bug |