Re: pg_recvlogical: honor source cluster file permissions for output files

From: Srinath Reddy Sadipiralla <srinath2133(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_recvlogical: honor source cluster file permissions for output files
Date: 2026-05-16 15:21:54
Message-ID: CAFC+b6qaCMoO7JZUx-etHJhinvPpQow8GKXZDXFfrCydeDtAdQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Fujii-san,

On Fri, May 15, 2026 at 8:29 PM Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:

> 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 have reviewed, tested the patch and it LGTM, i think we can add
a TAP test to verify the group permission, attached a diff patch
for the same,

I think this should be backpatched to all supported branches.
>

+1

--
Thanks,
Srinath Reddy Sadipiralla
EDB: https://www.enterprisedb.com/

Attachment Content-Type Size
nocfbot-test.patch application/octet-stream 1.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2026-05-16 15:53:49 Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?
Previous Message Mohamed ALi 2026-05-16 14:52:48 Re: [PATCH] Add NESTED_STATEMENTS option to EXPLAIN