Re: Fix pgstat_database.c to honor passed database OIDs
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Chao Li <li.evan.chao@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2026-04-10T06:12:41Z
Lists: pgsql-hackers
On Fri, Apr 10, 2026 at 01:53:15PM +0800, Chao Li wrote: > For pgstat_reset_database_timestamp(), in most paths dboid is also > just MyDatabaseId. However, there is one path where dboid can be > InvalidOid: The call of pgstat_reset_database_timestamp() in pgstat_reset() is a bug that has to be backpatched down to v15. It does not make sense to let a caller of pgstat_reset() pass down a custom dboid and then decide to reset the timestamp of MyDatabaseId instead. The call of pgstat_reset() in pgstat_create_transactional() is the only fishy one, the other callers are OK. If we decide to expand pgstat_reset() in other contexts in the back-branches, we'd be silently trapped as well. The connect and disconnect calls are less critical, perhaps we could remove the argument altogether, but I cannot get excited about that either as some extensions may rely on these as currently designed. I cannot look at that today, will do so later.. -- Michael
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Honor passed-in database OIDs in pgstat_database.c
- c6d3f05851a9 15.18 landed
- c7cdcbd3e6a7 16.14 landed
- a4fefb3e0dc5 17.10 landed
- b081c5b07309 18.4 landed
- 80156cee06b9 19 (unreleased) landed