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 <[email protected]>
Author: Jim Jones <[email protected]>
Author: Kirill Reshke <[email protected]>
Author: Surya Poondla <[email protected]>
Reviewed-by: Michael Paquier <[email protected]>
Discussion: 
https://postgr.es/m/[email protected]

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(-)

Reply via email to