Re: BUG #19520: PANIC when concurrently manipulating stored procedures with pg_stat_statements and track_functions =
Lukas Fittl <lukas@fittl.com>
From: Lukas Fittl <lukas@fittl.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Álvaro Herrera <alvherre@kurilemu.de>, Ayush Tiwari <ayushtiwari.slg01@gmail.com>, Sami Imseih <samimseih@gmail.com>, zlh21343@163.com, pgsql-bugs@lists.postgresql.org, Andres Freund <andres@anarazel.de>, Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Date: 2026-06-20T16:45:05Z
Lists: pgsql-bugs
On Sat, Jun 20, 2026 at 5:16 AM Michael Paquier <michael@paquier.xyz> wrote: > > On Sat, Jun 20, 2026 at 01:09:59PM +0200, Alvaro Herrera wrote: > > I think a better answer is to just not introduce the ABI change in > > stable branches. That is, I think we should add a shim function so that > > the third-party extensions can continue to use the original ABI; and > > only in master you clean that up with a different API, whereby the > > extension will be forced to have an #ifdef block for the 19 version or > > the older versions, but that's fine because the extension has to be > > recompiled for the new major version anyway so the end-user won't be > > affected on a minor upgrade. > > If you feel strongly about it, we could just do something like the > attached in the v15-v18 range. This introduces a new routine called > pgstat_drop_entry_ext() that gains the new argument "missing_ok", and > pgstat_drop_entry() would be an ABI-compatible wrapper calling it. > > What do you think? As the developer of the extension in the picture, I was actually surprised to see the commit making an ABI *and* API breaking change (and I think with cumulative stats being pluggable in 18, we can expect people to use public stats functions like pgstat_drop_entry in extensions), precisely because of the issues Alvaro mentioned. I think doing it with a new routine is what I would have expected to happen to preserve API and ABI compatibility, and your follow-up patch looks good to me. Thanks, Lukas -- Lukas Fittl
Commits
-
Re-introduce pgstat_drop_entry(), keeping ABI compatibility
- 9e47718250d8 15 (unreleased) landed
- e34b1ff5d894 16 (unreleased) landed
- afb076b2977c 17 (unreleased) landed
- fe464e9e6863 18 (unreleased) landed
-
Update .abi-compliance-history for pgstat_drop_entry()
- 75aca8b932e8 15 (unreleased) landed
- 7c457ea15c6d 16 (unreleased) landed
- 39e649d44a1d 17 (unreleased) landed
- 8a4f389ddce5 18 (unreleased) landed
-
Fix PANIC with track_functions due to concurrent drop of pgstats entries
- 1e9e62193c3f 15 (unreleased) landed
- bf4616b598a3 16 (unreleased) landed
- 2e0c61aed624 17 (unreleased) landed
- 5cc59834b860 18 (unreleased) landed
- 850b9218c8e4 19 (unreleased) landed