pgsql: Fix the fastpath rule for jsonb_concat with an empty operand.

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix the fastpath rule for jsonb_concat with an empty operand.
Date: 2015-09-13 21:15:23
Message-ID: E1ZbEcN-0002fK-AQ@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix the fastpath rule for jsonb_concat with an empty operand.

To prevent perverse results, we now only return the other operand if
it's not scalar, and if both operands are of the same kind (array or
object).

Original bug complaint and patch from Oskari Saarenmaa, extended by me
to cover the cases of different kinds of jsonb.

Backpatch to 9.5 where jsonb_concat was introduced.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/e7e3ac2d51130d707792e657facc58c160182342

Modified Files
--------------
src/backend/utils/adt/jsonfuncs.c | 16 ++++++++++-----
src/test/regress/expected/jsonb.out | 36 +++++++++++++++++++++++++++++++++
src/test/regress/expected/jsonb_1.out | 36 +++++++++++++++++++++++++++++++++
src/test/regress/sql/jsonb.sql | 7 +++++++
4 files changed, 90 insertions(+), 5 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2015-09-13 22:49:47 pgsql: Add noreturn attribute
Previous Message Peter Eisentraut 2015-09-13 04:07:58 pgsql: doc: Remove dead links