Re: update field in jsonb

From: Oleg Bartunov <obartunov(at)gmail(dot)com>
To: support-tiger <support(at)tigernassau(dot)com>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: update field in jsonb
Date: 2017-11-23 06:27:27
Message-ID: CAF4Au4x4F8UdchvJAdG9KAHHdgCXQyS46iZe4ir-p9-CcRQoZA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Nov 23, 2017 at 4:45 AM, support-tiger <support(at)tigernassau(dot)com> wrote:
> is there a way to update a single field in jsonb without replacing the
> entire json document - couldn't find an example
>
> for example
>
> create table test (id primary key, data jsonb);
>
> insert into test ({"name":"bill", "age":29});
>
> ?? update test set data->age = 30

update test set data = jsonb_set(data, '{age}', '30'::jsonb);

>
>
> --
> Support Dept
> Tiger Nassau, Inc.
> www.tigernassau.com
> 406-624-9310
>
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Brahmam Eswar 2017-11-23 08:59:53 [GENERAL] Date Time data types
Previous Message Ivan E. Panchenko 2017-11-23 06:06:02 Re: update field in jsonb