From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix PL/pgSQL's handling of anycompatiblemultirange.
Date: Mon, 26 Oct 2026 18:03:48 +0000
Message-ID: <E1xLP2y-00000000roG-12Rs@gemulon.postgresql.org> (raw)
Fix PL/pgSQL's handling of anycompatiblemultirange.
When validating a PL/pgSQL function with polymorphic arguments or
result type, we substitute a plausible concrete type for each
polymorphic type. anycompatiblemultirange was missed in both places
that do this, when multiranges were added. As a result, CREATE
FUNCTION with an anycompatiblemultirange argument failed with
"PL/pgSQL functions cannot accept type anycompatiblemultirange" when
check_function_bodies is on.
Also, a function returning anycompatiblemultirange was compiled by
the validator with an int4 result type, and since the function cache
key doesn't include the result type, a later call in the same session
with int4range arguments reused that entry and failed trying to cast
the multirange result to integer.
Map anycompatiblemultirange to int4multirange, as is done for
anymultirange, to fix both issues.
Author: Jeevan Chalke <jeevan.chalke@enterprisedb.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAM2+6=VEXCo7tPaxX+9_zN8SJ9DiPp2NTj_sPGN+Tb0wWTBp=w@mail.gmail.com
Backpatch-through: 14
Branch
------
REL_14_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/f291e3336d28f3f82ce0bb6503653ebe84ca7a50
Modified Files
--------------
src/pl/plpgsql/src/pl_comp.c | 4 +++-
1 file changed, 3 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 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: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Fix PL/pgSQL's handling of anycompatiblemultirange.
In-Reply-To: <E1xLP2y-00000000roG-12Rs@gemulon.postgresql.org>
References: <E1xLP2y-00000000roG-12Rs@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