Lists: | pgsql-hackers |
---|
From: | kelas <kelaskin(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | JSONB in-place updates? |
Date: | 2014-04-14 13:27:39 |
Message-ID: | CAPH8WwXBT2y8Q8DOzRqRtoEwMGSTXxqrp+NNQen2bGFC+W1cmw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Are there any plans to add "in-place at-depth" update operator for JSONB
type, e.g.:
UPDATE test SET attrs->'anwser' = 42 where attrs->'answer' = 41
From: | Josh Berkus <josh(at)agliodbs(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: JSONB in-place updates? |
Date: | 2014-04-14 20:16:37 |
Message-ID: | 534C4225.6020600@agliodbs.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On 04/14/2014 09:27 AM, kelas wrote:
> Are there any plans to add "in-place at-depth" update operator for JSONB
> type, e.g.:
>
> UPDATE test SET attrs->'anwser' = 42 where attrs->'answer' = 41
>
Plans, yes. But not until 9.5, or maybe as an extension.
--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com
From: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
---|---|
To: | Josh Berkus <josh(at)agliodbs(dot)com> |
Cc: | PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: JSONB in-place updates? |
Date: | 2014-04-15 02:23:12 |
Message-ID: | CAB7nPqRoPuGTM-bM5YY+p=bA94vPF802i=Bz2khvmXQEYCvUuQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Tue, Apr 15, 2014 at 5:16 AM, Josh Berkus <josh(at)agliodbs(dot)com> wrote:
> On 04/14/2014 09:27 AM, kelas wrote:
>> Are there any plans to add "in-place at-depth" update operator for JSONB
>> type, e.g.:
>>
>> UPDATE test SET attrs->'anwser' = 42 where attrs->'answer' = 41
>>
>
> Plans, yes. But not until 9.5, or maybe as an extension.
A custom function of the type find_and_modify(jsonb_data, key_name,
new_value) combined with the uniqueness of jsonb keys would be a good
workaround for now.
Regards,
--
Michael