Remove "invalid concatenation of jsonb objects" error case.
Tom Lane <tgl@sss.pgh.pa.us>
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
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/func.sgml | modified | +21 −1 |
| src/backend/utils/adt/jsonfuncs.c | modified | +34 −37 |
| src/test/regress/expected/jsonb.out | modified | +34 −2 |
| src/test/regress/sql/jsonb.sql | modified | +5 −0 |
Documentation touched
Discussion
- Weird special case in jsonb_concat() 5 messages · 2020-12-18 → 2020-12-21