public inbox for [email protected]  
help / color / mirror / Atom feed
From: Michael Paquier <[email protected]>
To: Dapeng Wang <[email protected]>
Cc: Chao Li <[email protected]>
Cc: PostgreSQL-development <[email protected]>
Subject: Re: Fix pgstat_database.c to honor passed database OIDs
Date: Mon, 13 Apr 2026 09:16:29 +0900
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAKx0YhzpuMkVwxa-fh36YOk11KZ6tjXnApAF=H6Sgso5a+P4Zg@mail.gmail.com>
References: <[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<CAKx0YhzpuMkVwxa-fh36YOk11KZ6tjXnApAF=H6Sgso5a+P4Zg@mail.gmail.com>

On Fri, Apr 10, 2026 at 09:01:32PM +0800, Dapeng Wang wrote:
> Without the patch, calling
> pg_stat_reset_single_table_counters('pg_shdescription'::regclass)
> incorrectly updates the current database's stats_reset timestamp
> while leaving the shared db entry (datid=0) unchanged.
> 
> With the patch, the shared db entry's stats_reset is correctly
> updated, and the current database's timestamp is not affected.

The coalesce() trick to bypass the fact that the reset timestamp may
not be reset was a bit ugly, so I have used instead a second reset.
I have limited the test to check for datid=0, not MyDatabaseId.

There is a bit down in stats.sql an extra portion of the test where we
use twice pg_stats_reset().  One reset could be removed, but I have
left it as-is in case someone decides to shuffle or split things in
this test script, to avoid problems in the future.

And fixed that down to v15.
--
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], [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