pgsql: pgstattuple: Reject unlogged and temporary relations during reco

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pgstattuple: Reject unlogged and temporary relations during reco
Date: 2026-11-09 08:05:21
Message-ID: E1xQKNV-00000000ojF-23UB@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

pgstattuple: Reject unlogged and temporary relations during recovery

Unlogged and temporary relations have no data on a standby, and trying
to query these would lead to the following failures:

ERROR: could not open file "base/MMM/NNN": No such file or directory

These cases are now blocked with a much better error message. Temporary
relations from other sessions were already blocked. pg_relpages() is an
exception and can work for temp tables created by other sessions.

While on it, the error messages are clarified to depend on the relkind.
Some of the functions reported relkinds unrelated to the relation
queried.

Reported-by: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Author: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
Author: Kirill Reshke <reshkekirill(at)gmail(dot)com>
Author: Surya Poondla <suryapoondla4(at)gmail(dot)com>
Reviewed-by: Michael Paquier <michael(at)paquier(dot)xyz>
Discussion: https://postgr.es/m/82ba0876-6127-4770-b900-aa1bd52abfed@uni-muenster.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0091c241f6cffb2b163f18dea54c10d0b45090aa

Modified Files
--------------
contrib/pgstattuple/pgstatapprox.c | 11 ++---------
contrib/pgstattuple/pgstatindex.c | 36 +++++++++---------------------------
contrib/pgstattuple/pgstattuple.c | 37 +++++++++++++++++++++++++++++++------
contrib/pgstattuple/pgstattuple.h | 21 +++++++++++++++++++++
4 files changed, 63 insertions(+), 42 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Aleksander Alekseev 2026-11-09 08:26:50 Re: pgsql: Make GetSnapshotData() more resilient on out-of-memory errors
Previous Message Michael Paquier 2026-11-09 06:47:23 pgsql: pageinspect: Reject access to temp and unlogged relations during