Re: Add missing stats_reset column to pg_stat_database_conflicts view

Fujii Masao <masao.fujii@gmail.com>

From: Fujii Masao <masao.fujii@gmail.com>
To: shihao zhong <zhong950419@gmail.com>
Cc: Sami Imseih <samimseih@gmail.com>, Kirill Reshke <reshkekirill@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2026-03-12T04:50:28Z
Lists: pgsql-hackers

Attachments

On Wed, Mar 11, 2026 at 11:10 PM shihao zhong <zhong950419@gmail.com> wrote:
> Thanks for pointing that out. I've added new tests and used git
> format-patch to generate a new patch.

Thanks for updating the patch!

+-- Test that the stats_reset column in pg_stat_database_conflicts is
correctly maintained
+SELECT pg_stat_reset();
+SELECT stats_reset IS NOT NULL AS has_stats_reset
+  FROM pg_stat_database_conflicts WHERE datname = current_database();

Since stats.sql already includes tests verifying that reset works for
pg_stat_database, it might be better to add the test for
pg_stat_database_conflicts alongside those, rather than at the end of
stats.sql. Thought? The attached updated patch does that.

I also fixed some indentation issues in the docs in the patch.

Regards,

-- 
Fujii Masao

Commits

  1. Simplify redundant current_database() subqueries in stats.sql regression test

  2. Add stats_reset column to pg_stat_database_conflicts.