Fix PL/Python crash when a SRF is redefined mid-execution

Edit
ID 6917
Title Fix PL/Python crash when a SRF is redefined mid-execution
CI (CFBot) Summary
Stats (from CFBot) Patch version: v2, Patch count: 1, First patch: +452−260, All patches: +452−260
Tags Bugfix
Created 2026-06-21 15:04:01
Last modified 2026-06-21 15:04:01 (3 hours ago)
Latest email 2026-06-18 12:13:57 (3 days ago)
Status
PG20-1 (2026-07-01 – 2026-07-31): Needs review
Target version
Authors Matheus Alcantara (matheus.alcantara)
Reviewers Tom Lane (tgl) Become reviewer
Committer
Links
Emails
BUG #19480: PL/Python SRF crashes (SIGSEGV) when function is replaced mid-iteration: use-after-free in PLy_funct
First at 2026-05-15 11:11:37 by PG Bug reporting form <noreply at postgresql.org>
Latest at 2026-06-18 12:13:57 by "Matheus Alcantara" <matheusssilv97 at gmail.com>
Latest attachment (v2-0001-plpython-Use-funccache.c-infrastructure-for-proce.patch) at 2026-06-18 12:13:57 from "Matheus Alcantara" <matheusssilv97 at gmail.com>
    Attachment (v2-0001-plpython-Use-funccache.c-infrastructure-for-proce.patch) at 2026-06-18 12:13:57 from "Matheus Alcantara" <matheusssilv97 at gmail.com> (Patch: Yes)
    Attachment (v1-0001-plpython-Use-funccache.c-infrastructure-for-proce.patch) at 2026-06-05 18:09:26 from "Matheus Alcantara" <matheusssilv97 at gmail.com> (Patch: Yes)
    Attachment (0001-plpython-Use-correct-memory-context-for-savedargs.patch) at 2026-05-25 22:26:17 from "Matheus Alcantara" <matheusssilv97 at gmail.com> (Patch: Yes)
History
When Who What
2026-06-21 15:04:04 Tom Lane (tgl) Added tgl as reviewer
2026-06-21 15:04:01 Tom Lane (tgl) Attached mail thread 19480-f1f9fdce30462fc4@postgresql.org
2026-06-21 15:04:01 Tom Lane (tgl) Created patch record
Edit