Search Postgresql Archives

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

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

 



On Thu, Jul 4, 2019 at 2:09 PM David G. Johnston <david.g.johnston@xxxxxxxxx> wrote:
On Thursday, July 4, 2019, Gianni Ceccarelli <dakkar@xxxxxxxxxxxxxxx> wrote:

> select to_jsonb('null'::text);
┌──────────┐
│ to_jsonb │
├──────────┤
│ "null"   │
└──────────┘


Json null


Sorry, my bad on this last one.  You cannot use to_jsonb to construct a json null.  The only way, I think, to construct a json null scalar is with an explicit literal.

SELECT 'null'::jsonb;

The to_jsonb function always interprets a textual value passed to it as being the literal text and so the original query results in a json string whose content is "null"

David J.


[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