Skip to content

Commit 6b797c8

Browse files
committed
Fix recovery.conf boolean variables to take the same range of string
values as postgresql.conf.
1 parent 5ce521f commit 6b797c8

File tree

3 files changed

+13
-18
lines changed

3 files changed

+13
-18
lines changed

src/backend/access/transam/xlog.c

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.314 2008/06/12 09:12:30 heikki Exp $
10+
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.315 2008/06/30 22:10:43 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -4523,13 +4523,10 @@ readRecoveryCommandFile(void)
45234523
/*
45244524
* does nothing if a recovery_target is not also set
45254525
*/
4526-
if (strcmp(tok2, "true") == 0)
4527-
recoveryTargetInclusive = true;
4528-
else
4529-
{
4530-
recoveryTargetInclusive = false;
4531-
tok2 = "false";
4532-
}
4526+
if (!parse_bool(tok2, &recoveryTargetInclusive))
4527+
ereport(ERROR,
4528+
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
4529+
errmsg("parameter \"recovery_target_inclusive\" requires a Boolean value")));
45334530
ereport(LOG,
45344531
(errmsg("recovery_target_inclusive = %s", tok2)));
45354532
}
@@ -4538,13 +4535,10 @@ readRecoveryCommandFile(void)
45384535
/*
45394536
* does nothing if a recovery_target is not also set
45404537
*/
4541-
if (strcmp(tok2, "true") == 0)
4542-
recoveryLogRestartpoints = true;
4543-
else
4544-
{
4545-
recoveryLogRestartpoints = false;
4546-
tok2 = "false";
4547-
}
4538+
if (!parse_bool(tok2, &recoveryLogRestartpoints))
4539+
ereport(ERROR,
4540+
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
4541+
errmsg("parameter \"log_restartpoints\" requires a Boolean value")));
45484542
ereport(LOG,
45494543
(errmsg("log_restartpoints = %s", tok2)));
45504544
}

src/backend/utils/misc/guc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.457 2008/06/30 10:58:47 heikki Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.458 2008/06/30 22:10:43 momjian Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -3991,7 +3991,7 @@ ReportGUCOption(struct config_generic * record)
39913991
* If the string parses okay, return true, else false.
39923992
* If okay and result is not NULL, return the value in *result.
39933993
*/
3994-
static bool
3994+
bool
39953995
parse_bool(const char *value, bool *result)
39963996
{
39973997
size_t len = strlen(value);

src/include/utils/guc.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Copyright (c) 2000-2008, PostgreSQL Global Development Group
88
* Written by Peter Eisentraut <peter_e@gmx.net>.
99
*
10-
* $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.96 2008/05/28 09:04:06 mha Exp $
10+
* $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.97 2008/06/30 22:10:43 momjian Exp $
1111
*--------------------------------------------------------------------
1212
*/
1313
#ifndef GUC_H
@@ -223,6 +223,7 @@ extern int NewGUCNestLevel(void);
223223
extern void AtEOXact_GUC(bool isCommit, int nestLevel);
224224
extern void BeginReportingGUCOptions(void);
225225
extern void ParseLongOption(const char *string, char **name, char **value);
226+
extern bool parse_bool(const char *value, bool *result);
226227
extern bool set_config_option(const char *name, const char *value,
227228
GucContext context, GucSource source,
228229
GucAction action, bool changeVal);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy