| From: | Masahiko Sawada <msawada(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Reject COPY TO of unlogged tables during recovery. |
| Date: | 2026-10-21 17:46:00 |
| Message-ID: | E1xJaO0-00000000DUD-42qZ@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Reject COPY TO of unlogged tables during recovery.
Unlogged tables have no data on a standby, so reading one there must
fail. SELECT and COPY (SELECT ...) TO already report a clear error,
but COPY with a table name read the table directly and failed with a
low-level error instead:
ERROR: could not open file "base/5/16384": No such file or directory
Check for this case in COPY TO and report the same error as SELECT. On
v19 and later, also check each partition when copying from a
partitioned table, so that an unlogged partition is reported too.
Backpatch to all supported versions, since the low-level error looks
like data corruption.
Author: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
Reviewed-by: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Reviewed-by: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Discussion: https://postgr.es/m/b6d71815-d362-4579-bf07-73eca01aee6d@uni-muenster.de
Backpatch-through: 14
Branch
------
REL_18_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/794c29dc41a6a930136cd086b22b72b8da927053
Modified Files
--------------
src/backend/commands/copyto.c | 5 +++++
src/test/recovery/t/001_stream_rep.pl | 13 +++++++++++++
2 files changed, 18 insertions(+)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Masahiko Sawada | 2026-10-21 17:46:04 | pgsql: Reject COPY TO of unlogged tables during recovery. |
| Previous Message | Masahiko Sawada | 2026-10-21 17:45:57 | pgsql: Reject COPY TO of unlogged tables during recovery. |