]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
pg_recvlogical: Honor source cluster file permissions for output files
authorFujii Masao <fujii@postgresql.org>
Wed, 20 May 2026 06:54:13 +0000 (15:54 +0900)
committerFujii Masao <fujii@postgresql.org>
Wed, 20 May 2026 06:57:04 +0000 (15:57 +0900)
Commit c37b3d08ca6 attempted to preserve group permissions on pg_recvlogical
output files when group access was enabled on the source cluster. However,
the output files were still created with a fixed S_IRUSR | S_IWUSR mode,
preventing group-read permissions from being applied.

This commit fixes the issue by creating output files with pg_file_create_mode
instead of a hard-coded mode. This allows pg_recvlogical to correctly preserve
group permissions from the source cluster.

Backpatch to all supported branches.

Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Srinath Reddy Sadipiralla <srinath2133@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwHhpizYzMo3nFP4GkNMueSNMY3QfC-gBN1VTXtuiANDvw@mail.gmail.com
Backpatch-through: 14

doc/src/sgml/ref/pg_recvlogical.sgml
src/bin/pg_basebackup/pg_recvlogical.c

index d38dc0b286e1db1451ed324d0f1f1c7299284a78..ef4fd28bebe5196115281a4de0105520c980b5e9 100644 (file)
@@ -457,7 +457,7 @@ PostgreSQL documentation
 
   <para>
    <application>pg_recvlogical</application> will preserve group permissions on
-   the received WAL files if group permissions are enabled on the source
+   the output files if group permissions are enabled on the source
    cluster.
   </para>
 
index 3db520ed38b650004e9207998a1dc2e540a49b1f..7424c475b81136b67ad1ba61a810db47fae79ce2 100644 (file)
@@ -340,7 +340,7 @@ StreamLogicalLog(void)
                                outfd = fileno(stdout);
                        else
                                outfd = open(outfile, O_CREAT | O_APPEND | O_WRONLY | PG_BINARY,
-                                                        S_IRUSR | S_IWUSR);
+                                                        pg_file_create_mode);
                        if (outfd == -1)
                        {
                                pg_log_error("could not open log file \"%s\": %m", outfile);