Fix trigger memory leak

From: Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Andres Freund <andres(at)anarazel(dot)de>
Subject: Fix trigger memory leak
Date: 2026-10-31 17:17:36
Message-ID: CA+renyVvS8K0YypfwYfRNT8-8OHoDKPPNv=pcSC0RdZx+uV__w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Hackers,

Here is a patch to fix some memory leaks in BEFORE/INSTEAD OF triggers.

Andres reported the problem in [0] while reviewing FOR PORTION OF, but
as he suspected, it is a problem on master too. It goes back to v14 at
least. You can reach it if (1) the rel is not a regular table (e.g. a
view) and (2) the trigger returns NEW without changing it (or NULL in
ExecIRInsertTriggers).

[0] https://www.postgresql.org/message-id/yfers7d2kizq6ockz4nu7e7avq3gj5anpd7ilxkazyvicv4qgy@3cesow2bbhnx

Yours,

--
Paul ~{:-)
pj(at)illuminatedcomputing(dot)com

Attachment Content-Type Size
v1-0001-Free-the-tuple-fetched-for-BEFORE-INSTEAD-OF-row-.patch text/x-patch 3.2 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Paul A Jungwirth 2026-10-31 17:20:22 Reject wholerow references where ColumnRef is forbidden
Previous Message Pierre Forstmann 2026-10-31 16:51:46 Re: Remove obsolete locking comment from AddBufferToRing()