From: | Gianni Ceccarelli <dakkar(at)thenautilus(dot)net> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Why does jsonb_set() remove non-mentioned keys? |
Date: | 2019-07-04 21:03:50 |
Message-ID: | 20190704220350.514a15a5@thenautilus.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Some experimentation:
> \pset null '((null))'
> select jsonb_set('{"foo":1}'::jsonb,'{bar}','null'::jsonb,true);
┌─────────────────────────┐
│ jsonb_set │
├─────────────────────────┤
│ {"bar": null, "foo": 1} │
└─────────────────────────┘
> select jsonb_set('{"foo":1}'::jsonb,'{bar}',to_jsonb(null::text),true);
┌───────────┐
│ jsonb_set │
├───────────┤
│ ((null)) │
└───────────┘
That's a bit weird already. Also:
> select null::jsonb;
┌──────────┐
│ jsonb │
├──────────┤
│ ((null)) │
└──────────┘
> select 'null'::jsonb;
┌───────┐
│ jsonb │
├───────┤
│ null │
└───────┘
> select to_jsonb(null::int);
┌──────────┐
│ to_jsonb │
├──────────┤
│ ((null)) │
└──────────┘
> select to_jsonb('null'::text);
┌──────────┐
│ to_jsonb │
├──────────┤
│ "null" │
└──────────┘
I'm sharing Thomas's confusion…
--
Dakkar - <Mobilis in mobile>
GPG public key fingerprint = A071 E618 DD2C 5901 9574
6FE2 40EA 9883 7519 3F88
key id = 0x75193F88
Work continues in this area.
-- DEC's SPR-Answering-Automaton
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2019-07-04 21:09:14 | Re: Why does jsonb_set() remove non-mentioned keys? |
Previous Message | Adrian Klaver | 2019-07-04 20:56:53 | Re: Converting to identity columns with domains on PK columns |