| From: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> |
|---|---|
| To: | Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Cc: | Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> |
| Subject: | Reject access to unlogged tables in contrib modules |
| Date: | 2026-10-18 14:08:45 |
| Message-ID: | 82ba0876-6127-4770-b900-aa1bd52abfed@uni-muenster.de |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi
A few contrib modules fail to handle unlogged relations during recovery,
which leads to rather unhelpful error messages:
== primary ==
create extension pgrowlocks;
create extension pgstattuple;
create extension pg_visibility;
create extension pageinspect;
create unlogged table ut as select 1;
== standby ==
psql (20devel)
Type "help" for help.
postgres=# select * from pgrowlocks('ut');
ERROR: could not open file "base/5/16458": No such file or directory
postgres=# select * from pgstattuple('ut');
ERROR: could not open file "base/5/16458": No such file or directory
postgres=# select * from pg_visibility('ut');
ERROR: could not open file "base/5/16458": No such file or directory
postgres=# select get_raw_page('ut',0);
ERROR: could not open file "base/5/16458": No such file or directory
Attached 4 patches adding checks to report a proper error message -- one
per module for easier reviewing:
psql (20devel)
Type "help" for help.
postgres=# select * from pgrowlocks('ut');
ERROR: cannot access temporary or unlogged relations during recovery
postgres=# select * from pgstattuple('ut');
ERROR: cannot access temporary or unlogged relations during recovery
postgres=# select * from pg_visibility('ut');
ERROR: cannot access temporary or unlogged relations during recovery
postgres=# select get_raw_page('ut',0);
ERROR: cannot access temporary or unlogged relations during recovery
postgres=#
I was unable to find any TAP test I could use to add these cases, and I
believe it could be an overkill to create one just to test these error
messages, so I decided to not include any tests for now. Let me know if
I am missing something here.
These bugs were reported by Zsolt (in CC) in another related thread[1]
Thanks!
Best, Jim
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-pageinspect-Reject-unlogged-relations-during-reco.patch | text/x-patch | 4.7 KB |
| v1-0002-pgrowlocks-Reject-unlogged-tables-during-recovery.patch | text/x-patch | 1.8 KB |
| v1-0003-pgstattuple-Reject-unlogged-relations-during-reco.patch | text/x-patch | 5.6 KB |
| v1-0004-pg_visibility-Reject-unlogged-tables-during-recov.patch | text/x-patch | 3.1 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jim Jones | 2026-10-18 14:14:25 | Re: Reject COPY TO of unlogged relations during recovery |
| Previous Message | Peter Geoghegan | 2026-10-18 13:50:51 | Re: index prefetching |