Rename jsonb_replace to jsonb_set and allow it to add new values
authorAndrew Dunstan <andrew@dunslane.net>
Mon, 1 Jun 2015 00:34:10 +0000 (20:34 -0400)
committerAndrew Dunstan <andrew@dunslane.net>
Mon, 1 Jun 2015 00:34:10 +0000 (20:34 -0400)
commit37def4224505f3a23a5eef000f0d05daea59c5b5
tree24ee85c2bdb98cc867245fadadc6b4f3fcc65165
parent75f9d17638c9c6bec34f80326c35010c47924728
Rename jsonb_replace to jsonb_set and allow it to add new values

The function is given a fourth parameter, which defaults to true. When
this parameter is true, if the last element of the path is missing
in the original json, jsonb_set creates it in the result and assigns it
the new value. If it is false then the function does nothing unless all
elements of the path are present, including the last.

Based on some original code from Dmitry Dolgov, heavily modified by me.

Catalog version bumped.
doc/src/sgml/func.sgml
src/backend/catalog/system_views.sql
src/backend/utils/adt/jsonfuncs.c
src/include/catalog/catversion.h
src/include/catalog/pg_proc.h
src/include/utils/jsonb.h
src/test/regress/expected/jsonb.out
src/test/regress/expected/jsonb_1.out
src/test/regress/sql/jsonb.sql