From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Common function for percent placeholder replacement
Date: Wed, 11 Jan 2023 10:08:04 +0000
Message-ID: <E1pFY1b-00374J-Px@gemulon.postgresql.org> (raw)
Common function for percent placeholder replacement
There are a number of places where a shell command is constructed with
percent-placeholders (like %x). It's cumbersome to have to open-code
this several times. This factors out this logic into a separate
function. This also allows us to ensure consistency for and document
some subtle behaviors, such as what to do with unrecognized
placeholders.
The unified handling is now that incorrect and unknown placeholders
are an error, where previously in most cases they were skipped or
ignored. This affects the following settings:
- archive_cleanup_command
- archive_command
- recovery_end_command
- restore_command
- ssl_passphrase_command
The following settings are part of this refactoring but already had
stricter error handling and should be unchanged in their behavior:
- basebackup_to_shell.command
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/5238bbed-0b01-83a6-d4b2-7eb0562a054e%40enterprisedb.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/c96de2ce1782116bd0489b1cd69ba88189a495e8
Modified Files
--------------
contrib/basebackup_to_shell/basebackup_to_shell.c | 56 +--------
src/backend/access/transam/xlogarchive.c | 45 +------
src/backend/libpq/be-secure-common.c | 38 ++----
src/backend/postmaster/shell_archive.c | 61 ++--------
src/common/Makefile | 1 +
src/common/archive.c | 85 ++------------
src/common/meson.build | 1 +
src/common/percentrepl.c | 137 ++++++++++++++++++++++
src/fe_utils/archive.c | 2 -
src/include/common/percentrepl.h | 18 +++
10 files changed, 198 insertions(+), 246 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: peter@eisentraut.org
Subject: Re: pgsql: Common function for percent placeholder replacement
In-Reply-To: <E1pFY1b-00374J-Px@gemulon.postgresql.org>
References: <E1pFY1b-00374J-Px@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox