Search Postgresql Archives

Re: Why does jsonb_set() remove non-mentioned keys?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux