summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2020-01-17 11:41:35 +1030
committerAndrew Dunstan <andrew@dunslane.net>2020-01-17 11:52:39 +1030
commita83586b5543b948f9e621462537a7303b113c482 (patch)
tree98c49e29a4b1a4014fd8ae040d6939812696a841 /doc/src
parentf7cd5896a69621818189fbdd209fb2e1fc008102 (diff)
Add a non-strict version of jsonb_set
jsonb_set_lax() is the same as jsonb_set, except that it takes and extra argument that specifies what to do if the value argument is NULL. The default is 'use_json_null'. Other possibilities are 'raise_exception', 'return_target' and 'delete_key', all these behaviours having been suggested as reasonable by various users. Discussion: https://postgr.es/m/375873e2-c957-3a8d-64f9-26c43c2b16e7@2ndQuadrant.com Reviewed by: Pavel Stehule
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/func.sgml23
1 files changed, 23 insertions, 0 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 4b42f128625..72072e75459 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -12232,6 +12232,9 @@ table2-mapping
<primary>jsonb_set</primary>
</indexterm>
<indexterm>
+ <primary>jsonb_set_lax</primary>
+ </indexterm>
+ <indexterm>
<primary>jsonb_insert</primary>
</indexterm>
<indexterm>
@@ -12546,6 +12549,26 @@ table2-mapping
</para></entry>
</row>
<row>
+ <entry><para><literal>jsonb_set_lax(target jsonb, path text[], new_value jsonb <optional>, create_missing boolean</optional> <optional>, null_value_treatment text</optional>)</literal>
+ </para></entry>
+ <entry><para><type>jsonb</type></para></entry>
+ <entry>
+ If <replaceable>new_value</replaceable> is not <literal>null</literal>,
+ behaves identically to <literal>jsonb_set</literal>. Otherwise behaves
+ according to the value of <replaceable>null_value_treatment</replaceable>
+ which must be one of <literal>'raise_exception'</literal>,
+ <literal>'use_json_null'</literal>, <literal>'delete_key'</literal>, or
+ <literal>'return_target'</literal>. The default is
+ <literal>'use_json_null'</literal>.
+ </entry>
+ <entry><para><literal>jsonb_set_lax('[{"f1":1,"f2":null},2,null,3]', '{0,f1}',null)</literal>
+ </para><para><literal>jsonb_set_lax('[{"f1":99,"f2":null},2]', '{0,f3}',null, true, 'return_target')</literal>
+ </para></entry>
+ <entry><para><literal>[{"f1":null,"f2":null},2,null,3]</literal>
+ </para><para><literal>[{"f1": 99, "f2": null}, 2]</literal>
+ </para></entry>
+ </row>
+ <row>
<entry>
<para><literal>
jsonb_insert(target jsonb, path text[], new_value jsonb <optional>, insert_after boolean</optional>)