From: | Glyn Astill <glynastill(at)yahoo(dot)co(dot)uk> |
---|---|
To: | Andreas Kretschmer <akretschmer(at)spamfence(dot)net>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: replacing jsonb field value |
Date: | 2015-05-30 21:45:08 |
Message-ID: | 542773010.2791490.1433022308833.JavaMail.yahoo@mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
----- Original Message -----
> From: Andreas Kretschmer <akretschmer(at)spamfence(dot)net>
> To: pgsql-general(at)postgresql(dot)org
> Cc:
> Sent: Saturday, 30 May 2015, 13:10
> Subject: Re: [GENERAL] replacing jsonb field value
>
> Michael Paquier <michael(dot)paquier(at)gmail(dot)com> wrote:
>
>>
>> Append the new value to it the existing field, jsonb has as property
>> to enforce key uniqueness, and uses the last value scanned for a given
>> key.
>
> can you show a simple example, how to append a jsonb to an jsonb-field?
> Maybe i'm blind, but i can't find how it works.
>
> Thx.
>
>
> Andreas
Prior to 9.5 you can't, I think you have to use something like jsonb_each to unwrap it then wrap it back up again.
The jsonbx extension, which I believe is what ended up in 9.5 has a simple concatenate function (here: https://github.com/erthalion/jsonbx), I also had a go (here: https://github.com/glynastill/pg_jsonb_opx).
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2015-05-31 00:55:55 | Re: [HACKERS] Re: 9.4.1 -> 9.4.2 problem: could not access status of transaction 1 |
Previous Message | Melvin Davidson | 2015-05-30 14:01:34 | Re: How to retrieve Comment text using SQL, not psql? |