pgsql: Add json_strip_nulls and jsonb_strip_nulls functions.

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Add json_strip_nulls and jsonb_strip_nulls functions.
Date: 2014-12-12 14:02:00
Message-ID: E1XzQnA-0003et-Ce@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add json_strip_nulls and jsonb_strip_nulls functions.

The functions remove object fields, including in nested objects, that
have null as a value. In certain cases this can lead to considerably
smaller datums, with no loss of semantic information.

Andrew Dunstan, reviewed by Pavel Stehule.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/237a8824430c607fce1eafde0c625744d50a455c

Modified Files
--------------
doc/src/sgml/func.sgml | 23 ++++
src/backend/utils/adt/jsonfuncs.c | 197 +++++++++++++++++++++++++++++++++
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_proc.h | 5 +
src/include/utils/json.h | 2 +
src/test/regress/expected/json.out | 50 +++++++++
src/test/regress/expected/json_1.out | 50 +++++++++
src/test/regress/expected/jsonb.out | 50 +++++++++
src/test/regress/expected/jsonb_1.out | 50 +++++++++
src/test/regress/sql/json.sql | 20 ++++
src/test/regress/sql/jsonb.sql | 19 ++++
11 files changed, 467 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2014-12-12 17:42:10 pgsql: Revert misguided change to postgres_fdw FOR UPDATE/SHARE code.
Previous Message Heikki Linnakangas 2014-12-12 12:27:36 pgsql: Put the logic to decide which synchronous standby is active into