public inbox for [email protected]  
help / color / mirror / Atom feed
From: Michael Paquier <[email protected]>
To: Chao Li <[email protected]>
Cc: PostgreSQL-development <[email protected]>
Subject: Re: Fix pgstat_database.c to honor passed database OIDs
Date: Fri, 10 Apr 2026 15:12:41 +0900
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

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


Attachments:

  [application/pgp-signature] signature.asc (833B, 2-signature.asc)
  download

view thread (7+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Fix pgstat_database.c to honor passed database OIDs
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox