pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix initialization of pg_stat_get_lastscan()
Date: Tue, 08 Nov 2022 01:51:05 +0000
Message-ID: <E1osDlY-0006K2-Lw@gemulon.postgresql.org> (raw)

Fix initialization of pg_stat_get_lastscan()

A NULL result should be reported when a stats timestamp is set to 0, but
c037471 missed that, leading to a confusing timestamp value after for
example a DML on a freshly-created relation with no scans done on it
yet.

This impacted the following attributes for two system views:
- pg_stat_all_tables.last_idx_scan
- pg_stat_all_tables.last_seq_scan
- pg_stat_all_indexes.last_idx_scan

Reported-by: Robert Treat
Analyzed-by: Peter Eisentraut
Author: Dave Page
Discussion: https://postgr.es/m/CABV9wwPzMfSaz3EfKXXDxKmMprbxwF5r6WPuxqA=5mzRUqfTGg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d7744d50a5394db8d973d1cfa034ed6640aec13c

Modified Files
--------------
src/backend/utils/adt/pgstatfuncs.c | 8 +++++++-
src/test/regress/expected/stats.out | 6 ++++++
src/test/regress/sql/stats.sql      | 1 +
3 files changed, 14 insertions(+), 1 deletion(-)



Message-ID: <E1osDlY-0006K2-Lw@gemulon.postgresql.org>
Permalink:  ../E1osDlY-0006K2-Lw@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1osDlY-0006K2-Lw@gemulon.postgresql.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz
  Subject: Re: pgsql: Fix initialization of pg_stat_get_lastscan()
  In-Reply-To: <E1osDlY-0006K2-Lw@gemulon.postgresql.org>
  References: <E1osDlY-0006K2-Lw@gemulon.postgresql.org>

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

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