pgsql: Close portals at end of trigger functions with transition tables

From: Noah Misch <noah(at)leadboat(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Close portals at end of trigger functions with transition tables
Date: 2026-11-09 14:22:16
Message-ID: E1xQQGG-000000004HX-37z7@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Close portals at end of trigger functions with transition tables.

The query environment needed for portals over transition tables for
triggers lasts only as long as the SPI connection, so the portals must
be closed. If not closed within the function, SPI_finish()
force-closes them.

Reported-by: Peter Geoghegan <pg(at)bowt(dot)ie>
Reviewed-by: Amit Langote <amitlangote09(at)gmail(dot)com>
Backpatch-through: 14
Security: CVE-2026-120143

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/84a4e2c18f20e1562dca42c00802b85bb1d57eb9
Author: Jeff Davis <jdavis(at)postgresql(dot)org>

Modified Files
--------------
doc/src/sgml/spi.sgml | 9 +++++++++
src/backend/executor/spi.c | 14 ++++++++++++++
src/backend/utils/mmgr/portalmem.c | 34 ++++++++++++++++++++++++++++++++++
src/include/utils/portal.h | 1 +
4 files changed, 58 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Noah Misch 2026-11-09 14:22:17 pgsql: Expand ALTER TABLE related tests
Previous Message Noah Misch 2026-11-09 14:22:15 pgsql: Forbid changing type if the rowtype is used in a foreign table