| From: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> |
|---|---|
| To: | Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Reject COPY TO of unlogged relations during recovery |
| Date: | 2026-10-15 18:52:53 |
| Message-ID: | b6d71815-d362-4579-bf07-73eca01aee6d@uni-muenster.de |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi
While testing the unlogged materialized views patch I noticed that copy
with an unlogged table from a standby tries to read a file that does not
exist on disk:
== primary ==
psql (20devel)
Type "help" for help.
postgres=# create unlogged table ut as select 1;
SELECT 1
== standby ==
psql (20devel)
Type "help" for help.
postgres=# copy ut to stdout;
ERROR: could not open file "base/5/16384": No such file or directory
I could reproduce this bug on PG14 as well:
== primary ==
psql (14.23 (Debian 14.23-1.pgdg13+1))
Geben Sie »help« für Hilfe ein.
postgres=# create unlogged table ut1 as select 1;
SELECT 1
== standby ==
psql (14.23 (Debian 14.23-1.pgdg13+1))
Geben Sie »help« für Hilfe ein.
postgres=# copy ut1 to stdout;
ERROR: could not open file "base/13759/772691051": No such file or
directory
I did some digging and found this thread[1] fixing a similar problem in
pg_dump, but I couldn't find anything similar on the server. I managed
to get a proper error message by adding a check in copyto.c (patch
attached), but I'm not sure this is the right place for it.
psql (20devel)
Type "help" for help.
postgres=# copy ut to stdout;
ERROR: cannot access temporary or unlogged relations during recovery
Before I put too much effort on tests I would like to hear your thoughts
on the approach.
Best, Jim
1 -
https://www.postgresql.org/message-id/flat/E1TutDO-0001Hb-2v%40wrigleys.postgresql.org
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Reject-COPY-TO-of-unlogged-relations-during-recov.patch | text/x-patch | 1.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2026-10-15 18:58:22 | Re: [PG19] psql backslash commands fail with translated messages and a non UTF-8 client encoding |
| Previous Message | Paul A Jungwirth | 2026-10-15 18:49:58 | Re: Fix WITHOUT OVERLAPS multirange with location replication |