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

From Jim Nasby
Subject Re: to_json(NULL) should to return JSON null instead NULL
Date
Msg-id 55E210C8.4070607@BlueTreble.com
Whole thread Raw
In response to Re: to_json(NULL) should to return JSON null instead NULL  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: to_json(NULL) should to return JSON null instead NULL  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: to_json(NULL) should to return JSON null instead NULL  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 8/29/15 12:29 PM, Pavel Stehule wrote:
>     Note that all the to_json functions are strict. In this sense it's
>     quite consistent. If we change it to being called on null input,
>     what should we return if a null non-scalar is passed in?
>
>
> what is correct from JSON perspective? All fields with NULL

ISTM that the whole purpose of to_json is to properly jsonify something, 
and the proper json form for "undefined" is 'null', is it not?
-- 
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com



pgsql-hackers by date:

Previous
From: Jim Nasby
Date:
Subject: Re: Fwd: Core dump with nested CREATE TEMP TABLE
Next
From: Pavel Stehule
Date:
Subject: Re: to_json(NULL) should to return JSON null instead NULL