pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <fujii@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix temporary relation I/O statistics in single-user mode
Date: Wed, 18 Nov 2026 07:10:29 +0000
Message-ID: <E1xTZoK-00000000CsE-3HT5@gemulon.postgresql.org> (raw)

Fix temporary relation I/O statistics in single-user mode

Accessing temporary relations in single-user mode could trigger an
assertion failure in assertion-enabled builds. For example, CREATE
TEMP TABLE AS and CREATE TEMP SEQUENCE failed when recording relation
extension statistics. Without assertions, the statistics were still
collected internally but were not exposed in pg_stat_io.

The problem was that pgstat_tracks_io_object() incorrectly excluded
standalone backends from I/O tracking for temporary relations, even
though they use local buffers just like regular client backends.

Remove this exclusion to prevent the assertion failures and make the
statistics visible in pg_stat_io.

Backpatch to v16, where the incorrect exclusion was introduced in
commit 28e626bde00.

Author: Manuel Reyes Bravo <manuelreyesbravo@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/179487554022.104798.7544124224648387746@gmail.com
Backpatch-through: 16

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4d6ff8a051a13b7c86255ff5d83ff2aa0dce302a

Modified Files
--------------
src/backend/utils/activity/pgstat_io.c | 14 +++++++-------
src/test/regress/expected/stats.out    |  3 ++-
2 files changed, 9 insertions(+), 8 deletions(-)



view thread (5+ messages)  latest in thread

Message-ID: <E1xTZoK-00000000CsE-3HT5@gemulon.postgresql.org>
Permalink:  ../E1xTZoK-00000000CsE-3HT5@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xTZoK-00000000CsE-3HT5@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: fujii@postgresql.org
  Subject: Re: pgsql: Fix temporary relation I/O statistics in single-user mode
  In-Reply-To: <E1xTZoK-00000000CsE-3HT5@gemulon.postgresql.org>
  References: <E1xTZoK-00000000CsE-3HT5@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