From c96de2ce1782116bd0489b1cd69ba88189a495e8 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 11 Jan 2023 07:22:51 +0100 Subject: 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 Discussion: https://www.postgresql.org/message-id/flat/5238bbed-0b01-83a6-d4b2-7eb0562a054e%40enterprisedb.com --- src/fe_utils/archive.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/fe_utils/archive.c') diff --git a/src/fe_utils/archive.c b/src/fe_utils/archive.c index aab813c102..eb1c930ae7 100644 --- a/src/fe_utils/archive.c +++ b/src/fe_utils/archive.c @@ -48,8 +48,6 @@ RestoreArchivedFile(const char *path, const char *xlogfname, xlogRestoreCmd = BuildRestoreCommand(restoreCommand, xlogpath, xlogfname, NULL); - if (xlogRestoreCmd == NULL) - pg_fatal("cannot use restore_command with %%r placeholder"); /* * Execute restore_command, which should copy the missing file from -- cgit v1.2.1