1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

Revert 95d737ff to add 'ignore_nulls'

Per discussion, revert the commit which added 'ignore_nulls' to
row_to_json.  This capability would be better added as an independent
function rather than being bolted on to row_to_json.  Additionally,
the implementation didn't address complex JSON objects, and so was
incomplete anyway.

Pointed out by Tom and discussed with Andrew and Robert.
This commit is contained in:
Stephen Frost
2014-09-29 13:32:22 -04:00
parent def4c28cf9
commit c8a026e4f1
8 changed files with 52 additions and 119 deletions

View File

@ -98,32 +98,8 @@ FROM generate_series(1,3) AS x;
SELECT row_to_json(q,true)
FROM rows q;
SELECT row_to_json(q,pretty := true)
FROM rows q;
SELECT row_to_json(row((select array_agg(x) as d from generate_series(5,10) x)),false);
WITH x AS (SELECT a,b,c FROM (VALUES(10,20,30),
(10,NULL, NULL),
(NULL, NULL, NULL)) g(a,b,c))
SELECT row_to_json(x, false, false) FROM x;
WITH x AS (SELECT a,b,c FROM (VALUES(10,20,30),
(10,NULL, NULL),
(NULL, NULL, NULL)) g(a,b,c))
SELECT row_to_json(x, false, true) FROM x;
WITH x AS (SELECT a,b,c FROM (VALUES(10,20,30),
(10,NULL, NULL),
(NULL, NULL, NULL)) g(a,b,c))
SELECT row_to_json(x, ignore_nulls := true) FROM x;
WITH x AS (SELECT a,b,c FROM (VALUES(10,20,30),
(10,NULL, NULL),
(NULL, NULL, NULL)) g(a,b,c))
SELECT row_to_json(x, ignore_nulls := true, pretty := true) FROM x;
-- to_json, timestamps
select to_json(timestamp '2014-05-28 12:22:35.614298');