pg_recvlogical: honor source cluster file permissions for output files

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: pg_recvlogical: honor source cluster file permissions for output files
Date: 2026-05-15 14:59:15
Message-ID: CAHGQGwHhpizYzMo3nFP4GkNMueSNMY3QfC-gBN1VTXtuiANDvw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

The pg_recvlogical documentation says:

pg_recvlogical will preserve group permissions on the received WAL files
if group permissions are enabled on the source cluster.

However, a user let me know that pg_recvlogical does not actually preserve
group permissions on its output files, even when group permissions are enabled
on the source cluster. This seems a bug.

Commit c37b3d08ca6 attempted to preserve group permissions when group
access is enabled on the source cluster. However, the output files are still
created with a hard-coded S_IRUSR | S_IWUSR mode, so group-read permission
is never applied.

The attached patch fixes this by creating output files with pg_file_create_mode
instead of the hard-coded mode. Since pg_recvlogical already sets
umask(pg_mode_mask) based on the source cluster settings, this makes
the output file permissions match the source cluster configuration as intended.

The patch also updates the documentation wording from "received WAL files"
to "output files", which better reflects what pg_recvlogical actually writes.

I think this should be backpatched to all supported branches.

Regards,

--
Fujii Masao

Attachment Content-Type Size
v1-0001-pg_recvlogical-Honor-source-cluster-file-permissi.patch application/octet-stream 1.9 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Junwang Zhao 2026-05-15 15:01:06 Re: (SQL/PGQ) cache lookup failed for label
Previous Message Nathan Bossart 2026-05-15 14:46:34 Re: [PATCH] refint: Avoid reusing cascade UPDATE plans.