Common function for percent placeholder replacement
authorPeter Eisentraut <[email protected]>
Wed, 11 Jan 2023 06:22:51 +0000 (07:22 +0100)
committerPeter Eisentraut <[email protected]>
Wed, 11 Jan 2023 09:42:35 +0000 (10:42 +0100)
commitc96de2ce1782116bd0489b1cd69ba88189a495e8
treef0d108a772f4c96966ab877b1b4a24f4e8b26713
parent5f6401f81cb24bd3930e0dc589fc4aa8b5424cdc
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 <[email protected]>
Discussion: https://www.postgresql.org/message-id/flat/5238bbed-0b01-83a6-d4b2-7eb0562a054e%40enterprisedb.com
contrib/basebackup_to_shell/basebackup_to_shell.c
src/backend/access/transam/xlogarchive.c
src/backend/libpq/be-secure-common.c
src/backend/postmaster/shell_archive.c
src/common/Makefile
src/common/archive.c
src/common/meson.build
src/common/percentrepl.c [new file with mode: 0644]
src/fe_utils/archive.c
src/include/common/percentrepl.h [new file with mode: 0644]