Skip to content

Commit c53835e

Browse files
committed
Fix recovery_target_action validation in restore command
- Only write recovery_target_action to PostgreSQL config when value is 'promote' or 'shutdown' - Add warning log for unsupported target-action values (prevents invalid config like '!') - Fixes documentation build failure where '!' was being written to recovery_target_action
1 parent 52d9b23 commit c53835e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/command/restore/restore.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1571,10 +1571,17 @@ restoreRecoveryOption(const unsigned int pgVersion)
15711571
{
15721572
const StringId targetAction = cfgOptionStrId(cfgOptTargetAction);
15731573

1574-
if (targetAction != CFGOPTVAL_TARGET_ACTION_PAUSE)
1574+
if (targetAction == CFGOPTVAL_TARGET_ACTION_PROMOTE || targetAction == CFGOPTVAL_TARGET_ACTION_SHUTDOWN)
15751575
{
15761576
kvPut(result, VARSTRZ(RECOVERY_TARGET_ACTION), VARSTR(strIdToStr(targetAction)));
15771577
}
1578+
else if (targetAction != CFGOPTVAL_TARGET_ACTION_PAUSE)
1579+
{
1580+
LOG_WARN_FMT(
1581+
"option '" CFGOPT_TARGET_ACTION "' value '%s' ignored, defaulting to '"
1582+
CFGOPTVAL_TARGET_ACTION_PAUSE_Z "'",
1583+
strZ(strIdToStr(targetAction)));
1584+
}
15781585
}
15791586

15801587
// Write recovery_target_timeline if set

0 commit comments

Comments
 (0)