Add json_strip_nulls and jsonb_strip_nulls functions.
Andrew Dunstan <andrew@dunslane.net>
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.
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/func.sgml | modified | +23 −0 |
| src/backend/utils/adt/jsonfuncs.c | modified | +197 −0 |
| src/include/catalog/catversion.h | modified | +1 −1 |
| src/include/catalog/pg_proc.h | modified | +5 −0 |
| src/include/utils/json.h | modified | +2 −0 |
| src/test/regress/expected/json_1.out | modified | +50 −0 |
| src/test/regress/expected/jsonb_1.out | modified | +50 −0 |
| src/test/regress/expected/jsonb.out | modified | +50 −0 |
| src/test/regress/expected/json.out | modified | +50 −0 |
| src/test/regress/sql/jsonb.sql | modified | +19 −0 |
| src/test/regress/sql/json.sql | modified | +20 −0 |