pgsql: pgstattuple: Reject unlogged and temporary relations during reco

Started by Michael Paquier13 days ago1 messagescommitters
Jump to latest
#1Michael Paquier
michael@paquier.xyz

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.parragi@percona.com>
Author: Jim Jones <jim.jones@uni-muenster.de>
Author: Kirill Reshke <reshkekirill@gmail.com>
Author: Surya Poondla <suryapoondla4@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: /messages/by-id/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(-)