summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/access/transam/xlog.c22
-rw-r--r--src/backend/utils/misc/guc.c2
-rw-r--r--src/include/utils/guc.h1
3 files changed, 10 insertions, 15 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index dfe8375d1f..c40fb5b4a0 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -4523,13 +4523,10 @@ readRecoveryCommandFile(void)
/*
* does nothing if a recovery_target is not also set
*/
- if (strcmp(tok2, "true") == 0)
- recoveryTargetInclusive = true;
- else
- {
- recoveryTargetInclusive = false;
- tok2 = "false";
- }
+ if (!parse_bool(tok2, &recoveryTargetInclusive))
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("parameter \"recovery_target_inclusive\" requires a Boolean value")));
ereport(LOG,
(errmsg("recovery_target_inclusive = %s", tok2)));
}
@@ -4538,13 +4535,10 @@ readRecoveryCommandFile(void)
/*
* does nothing if a recovery_target is not also set
*/
- if (strcmp(tok2, "true") == 0)
- recoveryLogRestartpoints = true;
- else
- {
- recoveryLogRestartpoints = false;
- tok2 = "false";
- }
+ if (!parse_bool(tok2, &recoveryLogRestartpoints))
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("parameter \"log_restartpoints\" requires a Boolean value")));
ereport(LOG,
(errmsg("log_restartpoints = %s", tok2)));
}
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 456560ba3b..66cc03df0e 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -3991,7 +3991,7 @@ ReportGUCOption(struct config_generic * record)
* If the string parses okay, return true, else false.
* If okay and result is not NULL, return the value in *result.
*/
-static bool
+bool
parse_bool(const char *value, bool *result)
{
size_t len = strlen(value);
diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h
index 7649ffc342..004df9fdd2 100644
--- a/src/include/utils/guc.h
+++ b/src/include/utils/guc.h
@@ -223,6 +223,7 @@ extern int NewGUCNestLevel(void);
extern void AtEOXact_GUC(bool isCommit, int nestLevel);
extern void BeginReportingGUCOptions(void);
extern void ParseLongOption(const char *string, char **name, char **value);
+extern bool parse_bool(const char *value, bool *result);
extern bool set_config_option(const char *name, const char *value,
GucContext context, GucSource source,
GucAction action, bool changeVal);