jsonb merge with update ... on conflict do

From: Eugene Pazhitnov <pazhitnov(at)gmail(dot)com>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: jsonb merge with update ... on conflict do
Date: 2021-06-01 11:53:10
Message-ID: CAGfKbExSO8SWxGUM+=1fxeZaNHknvmfBiqqVyQ2zMNFbQSm1Nw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi guys!

Is it a bug or do I miss something?

$ psql xbox -X
psql (13.2 (Ubuntu 13.2-1.pgdg20.04+1))
Type "help" for help.

xbox=> create temp table test(id int primary key, price jsonb);
CREATE TABLE
xbox=> insert into test values(1,'{"RU":10}');
INSERT 0 1
xbox=> select * from test;
id | price
----+------------
1 | {"RU": 10}
(1 row)

xbox=> insert into test values(1,'{"CA":20}') on conflict(id) do update set
price=EXCLUDED.price || '{"CA":20}'::jsonb;
INSERT 0 1
xbox=> select * from test;
id | price
----+------------
1 | {"CA": 20}
(1 row)

xbox=> \q
$

*Expected*:
{"CA":20,"RU":10}

--
Evgeny Pazhitnov

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Sergei Kornilov 2021-06-01 11:58:04 Re: jsonb merge with update ... on conflict do
Previous Message Bharath Rupireddy 2021-06-01 10:24:31 Re: Query on postgres_fdw extension