pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix PL/pgSQL's handling of anycompatiblemultirange. 7+ messages / 1 participants [nested] [flat]
* pgsql: Fix PL/pgSQL's handling of anycompatiblemultirange. @ 2026-10-26 18:03 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2026-10-26 18:03 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 ------ master Details ------- https://git.postgresql.org/pg/commitdiff/663c34c1eb2c71f35955814923ad578d0d9c0cf1 Modified Files -------------- src/backend/utils/cache/funccache.c | 1 + src/pl/plpgsql/src/pl_comp.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix PL/pgSQL's handling of anycompatiblemultirange. @ 2026-10-26 18:03 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2026-10-26 18:03 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/791446a140a7392261756f6e0d466cc2b8224ebd Modified Files -------------- src/backend/utils/cache/funccache.c | 1 + src/pl/plpgsql/src/pl_comp.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix PL/pgSQL's handling of anycompatiblemultirange. @ 2026-10-26 18:03 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2026-10-26 18:03 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/a34d61616134c75694e99abf8beb58b7b82b3455 Modified Files -------------- src/backend/utils/cache/funccache.c | 1 + src/pl/plpgsql/src/pl_comp.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix PL/pgSQL's handling of anycompatiblemultirange. @ 2026-10-26 18:03 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2026-10-26 18:03 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/fa10d961d3748c4d995b892875b31003ae726817 Modified Files -------------- src/pl/plpgsql/src/pl_comp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix PL/pgSQL's handling of anycompatiblemultirange. @ 2026-10-26 18:03 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2026-10-26 18:03 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/658e1509250352adafe01fe3e3a51448126fd58e Modified Files -------------- src/pl/plpgsql/src/pl_comp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix PL/pgSQL's handling of anycompatiblemultirange. @ 2026-10-26 18:03 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2026-10-26 18:03 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/9df4d21acb4dbb4a264777e499f2be5c805d2be4 Modified Files -------------- src/pl/plpgsql/src/pl_comp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix PL/pgSQL's handling of anycompatiblemultirange. @ 2026-10-26 18:03 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2026-10-26 18:03 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2026-10-26 18:03 UTC | newest] Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-10-26 18:03 pgsql: Fix PL/pgSQL's handling of anycompatiblemultirange. Tom Lane <tgl@sss.pgh.pa.us> 2026-10-26 18:03 pgsql: Fix PL/pgSQL's handling of anycompatiblemultirange. Tom Lane <tgl@sss.pgh.pa.us> 2026-10-26 18:03 pgsql: Fix PL/pgSQL's handling of anycompatiblemultirange. Tom Lane <tgl@sss.pgh.pa.us> 2026-10-26 18:03 pgsql: Fix PL/pgSQL's handling of anycompatiblemultirange. Tom Lane <tgl@sss.pgh.pa.us> 2026-10-26 18:03 pgsql: Fix PL/pgSQL's handling of anycompatiblemultirange. Tom Lane <tgl@sss.pgh.pa.us> 2026-10-26 18:03 pgsql: Fix PL/pgSQL's handling of anycompatiblemultirange. Tom Lane <tgl@sss.pgh.pa.us> 2026-10-26 18:03 pgsql: Fix PL/pgSQL's handling of anycompatiblemultirange. Tom Lane <tgl@sss.pgh.pa.us>
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