pgsql: Remove "invalid concatenation of jsonb objects" error case.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Remove "invalid concatenation of jsonb objects" error case.
Date: 2020-12-21 18:12:22
Message-ID: E1krPfS-0005XO-Ce@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/542248f9ddfd49f268b2edc4b6beeff7cf0b6aba

Modified Files
--------------
doc/src/sgml/func.sgml | 11 +++--
src/backend/utils/adt/jsonfuncs.c | 85 +++++++++++++++++--------------------
src/test/regress/expected/jsonb.out | 36 +++++++++++++++-
src/test/regress/sql/jsonb.sql | 5 +++
4 files changed, 86 insertions(+), 51 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tomas Vondra 2020-12-21 18:36:30 pgsql: Disallow SRFs when considering sorts below Gather Merge
Previous Message Tomas Vondra 2020-12-21 17:58:07 pgsql: Check parallel safety in generate_useful_gather_paths