From: Alexander Korotkov <akorotkov@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Throw error when assigning jsonb scalar instead of a composite o
Date: Sun, 31 Jan 2021 20:54:27 +0000
Message-ID: <E1l6Jjn-0000kt-81@gemulon.postgresql.org> (raw)
Throw error when assigning jsonb scalar instead of a composite object
During the jsonb subscripting assignment, the provided path might assume an
object or an array where the source jsonb has a scalar value. Initial
subscripting assignment logic will skip such an update operation with no
message shown. This commit makes it throw an error to indicate this type
of situation.
Discussion: https://postgr.es/m/CA%2Bq6zcV8qvGcDXurwwgUbwACV86Th7G80pnubg42e-p9gsSf%3Dg%40mail.gmail.com
Discussion: https://postgr.es/m/CA%2Bq6zcX3mdxGCgdThzuySwH-ApyHHM-G4oB1R0fn0j2hZqqkLQ%40mail.gmail.com
Discussion: https://postgr.es/m/CA%2Bq6zcVDuGBv%3DM0FqBYX8DPebS3F_0KQ6OVFobGJPM507_SZ_w%40mail.gmail.com
Discussion: https://postgr.es/m/CA%2Bq6zcVovR%2BXY4mfk-7oNk-rF91gH0PebnNfuUjuuDsyHjOcVA%40mail.gmail.com
Author: Dmitry Dolgov
Reviewed-by: Tom Lane, Arthur Zakirov, Pavel Stehule, Dian M Fay
Reviewed-by: Andrew Dunstan, Chapman Flack, Merlin Moncure, Peter Geoghegan
Reviewed-by: Alvaro Herrera, Jim Nasby, Josh Berkus, Victor Wagner
Reviewed-by: Aleksander Alekseev, Robert Haas, Oleg Bartunov
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/aa6e46daf5304e8d9e66fefc1a5bd77622ec6402
Modified Files
--------------
doc/src/sgml/json.sgml | 39 +++++++++++++++++++++++++++++--------
src/backend/utils/adt/jsonfuncs.c | 29 +++++++++++++++++++++++++++
src/test/regress/expected/jsonb.out | 27 +++++++++++++++++++++++++
src/test/regress/sql/jsonb.sql | 17 ++++++++++++++++
4 files changed, 104 insertions(+), 8 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: akorotkov@postgresql.org
Subject: Re: pgsql: Throw error when assigning jsonb scalar instead of a composite o
In-Reply-To: <E1l6Jjn-0000kt-81@gemulon.postgresql.org>
References: <E1l6Jjn-0000kt-81@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox