to_json(NULL) should to return JSON null instead NULL - Mailing list pgsql-hackers

From Pavel Stehule
Subject to_json(NULL) should to return JSON null instead NULL
Date
Msg-id CAFj8pRBdi4Ud-=8kfM28i7fa=B6t=nFTM3UK5qNBm9TjazC99A@mail.gmail.com
Whole thread Raw
Responses Re: to_json(NULL) should to return JSON null instead NULL  ("Shulgin, Oleksandr" <oleksandr.shulgin@zalando.de>)
List pgsql-hackers
Hi

currently JSON support NULL value - but we doesn't convert NULL to JSON correctly

postgres=# select to_json(NULL::text) IS NULL;
┌──────────┐
│ ?column? │
╞══════════╡
│ t        │
└──────────┘
(1 row)


probably should be json "null";

like

postgres=# select json 'null' is null;
┌──────────┐
│ ?column? │
╞══════════╡
│ f        │
└──────────┘
(1 row)


?

Regards


Pavel

pgsql-hackers by date:

Previous
From: Noah Misch
Date:
Subject: Re: [BUGS] Compile fails on AIX 6.1
Next
From: "Shulgin, Oleksandr"
Date:
Subject: Re: to_json(NULL) should to return JSON null instead NULL