Use a constant to check restore target action.
Checking the default here was fragile. If the default were to change the code would break.
This also removes the only dependency on cfgOptionDefault() outside of the help command.
@@ -40,6 +40,8 @@ Recovery constants
#define RECOVERY_TARGET_XID "recovery_target_xid"
#define RECOVERY_TARGET_ACTION "recovery_target_action"
+#define RECOVERY_TARGET_ACTION_PAUSE "pause"
+ STRING_STATIC(RECOVERY_TARGET_ACTION_PAUSE_STR, RECOVERY_TARGET_ACTION_PAUSE);
#define RECOVERY_TARGET_ACTION_SHUTDOWN "shutdown"
STRING_STATIC(RECOVERY_TARGET_ACTION_SHUTDOWN_STR, RECOVERY_TARGET_ACTION_SHUTDOWN);
@@ -1409,7 +1411,7 @@ restoreRecoveryOption(unsigned int pgVersion)
{
const String *targetAction = cfgOptionStr(cfgOptTargetAction);
- if (!strEq(targetAction, varStr(cfgOptionDefault(cfgOptTargetAction))))
+ if (!strEq(targetAction, RECOVERY_TARGET_ACTION_PAUSE_STR))
{
// Write recovery_target on supported PostgreSQL versions
if (pgVersion >= PG_VERSION_RECOVERY_TARGET_ACTION)
