summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2020-12-21 13:11:30 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2020-12-21 13:11:30 -0500
commit542248f9ddfd49f268b2edc4b6beeff7cf0b6aba (patch)
tree3d5fd5f32fed69521fe5a08d229592f8075f755c /doc/src
parentefaeabcc1c37d0908ddc6e868a64e1293817ad0f (diff)
Remove "invalid concatenation of jsonb objects" error case.
The jsonb || jsonb operator arbitrarily rejected certain combinations of scalar and non-scalar inputs, while being willing to concatenate other combinations. This was of course quite undocumented. Rather than trying to document it, let's just remove the restriction, creating a uniform rule that unless we are handling an object-to-object concatenation, non-array inputs are converted to one-element arrays, resulting in an array-to-array concatenation. (This does not change the behavior for any case that didn't throw an error before.) Per complaint from Joel Jacobson. Back-patch to all supported branches. Discussion: https://postgr.es/m/163099.1608312033@sss.pgh.pa.us
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/func.sgml11
1 files changed, 7 insertions, 4 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 903e52814d5..20626b2a13b 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -11313,10 +11313,13 @@ table2-mapping
<note>
<para>
- The <literal>||</> operator concatenates the elements at the top level of
- each of its operands. It does not operate recursively. For example, if
- both operands are objects with a common key field name, the value of the
- field in the result will just be the value from the right hand operand.
+ The <literal>||</literal> operator concatenates two JSON objects by
+ generating an object containing the union of their keys, taking the
+ second object's value when there are duplicate keys. All other cases
+ produce a JSON array: first, any non-array input is converted into a
+ single-element array, and then the two arrays are concatenated.
+ It does not operate recursively; only the top-level array or object
+ structure is merged.
</para>
</note>