From: Amit Langote <amitlan@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: SQL/JSON: Fix coercion of constructor outputs to types with typm
Date: Fri, 28 Jun 2024 13:03:35 +0000
Message-ID: <E1sNBGI-003Mpl-VF@gemulon.postgresql.org> (raw)
SQL/JSON: Fix coercion of constructor outputs to types with typmod
Ensure SQL/JSON constructor functions that allow specifying the
target type using the RETURNING clause perform implicit cast to
that type. This ensures that output values that exceed the specified
length produce an error rather than being silently truncated. This
behavior conforms to the SQL standard.
Reported-by: Alvaro Herrera <alvherre@alvh.no-ip.org>
Reviewed-by: Jian He <jian.universality@gmail.com>
Discussion: https://postgr.es/m/202405271326.5a5rprki64aw%40alvherre.pgsql
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/c2d93c3802b205d135d1ae1d7ac167d74e08a274
Modified Files
--------------
src/backend/parser/parse_expr.c | 24 +++++++++++++++++++++++-
src/test/regress/expected/sqljson.out | 17 +++++++++++++++++
src/test/regress/sql/sqljson.sql | 12 ++++++++++++
3 files changed, 52 insertions(+), 1 deletion(-)
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 using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: amitlan@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: SQL/JSON: Fix coercion of constructor outputs to types with typm
In-Reply-To: <E1sNBGI-003Mpl-VF@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