|
|
|
@ -10,7 +10,7 @@ |
|
|
|
* Written by Peter Eisentraut <peter_e@gmx.net>. |
|
|
|
* Written by Peter Eisentraut <peter_e@gmx.net>. |
|
|
|
* |
|
|
|
* |
|
|
|
* IDENTIFICATION |
|
|
|
* IDENTIFICATION |
|
|
|
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.138 2003/07/22 20:29:13 momjian Exp $ |
|
|
|
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.139 2003/07/25 20:17:56 tgl Exp $ |
|
|
|
* |
|
|
|
* |
|
|
|
*-------------------------------------------------------------------- |
|
|
|
*-------------------------------------------------------------------- |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@ -52,7 +52,6 @@ |
|
|
|
#include "utils/array.h" |
|
|
|
#include "utils/array.h" |
|
|
|
#include "utils/builtins.h" |
|
|
|
#include "utils/builtins.h" |
|
|
|
#include "utils/datetime.h" |
|
|
|
#include "utils/datetime.h" |
|
|
|
#include "utils/elog.h" |
|
|
|
|
|
|
|
#include "utils/pg_locale.h" |
|
|
|
#include "utils/pg_locale.h" |
|
|
|
#include "pgstat.h" |
|
|
|
#include "pgstat.h" |
|
|
|
|
|
|
|
|
|
|
|
@ -1580,7 +1579,9 @@ build_guc_variables(void) |
|
|
|
guc_vars = (struct config_generic **) |
|
|
|
guc_vars = (struct config_generic **) |
|
|
|
malloc(num_vars * sizeof(struct config_generic *)); |
|
|
|
malloc(num_vars * sizeof(struct config_generic *)); |
|
|
|
if (!guc_vars) |
|
|
|
if (!guc_vars) |
|
|
|
elog(PANIC, "out of memory"); |
|
|
|
ereport(FATAL, |
|
|
|
|
|
|
|
(errcode(ERRCODE_OUT_OF_MEMORY), |
|
|
|
|
|
|
|
errmsg("out of memory"))); |
|
|
|
|
|
|
|
|
|
|
|
num_vars = 0; |
|
|
|
num_vars = 0; |
|
|
|
|
|
|
|
|
|
|
|
@ -1688,10 +1689,6 @@ InitializeGUCOptions(void) |
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Load all variables with their compiled-in defaults, and initialize |
|
|
|
* Load all variables with their compiled-in defaults, and initialize |
|
|
|
* status fields as needed. |
|
|
|
* status fields as needed. |
|
|
|
* |
|
|
|
|
|
|
|
* Note: any errors here are reported with plain ol' printf, since we |
|
|
|
|
|
|
|
* shouldn't assume that elog will work before we've initialized its |
|
|
|
|
|
|
|
* config variables. An error here would be unexpected anyway... |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
for (i = 0; i < num_guc_variables; i++) |
|
|
|
for (i = 0; i < num_guc_variables; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -1711,8 +1708,8 @@ InitializeGUCOptions(void) |
|
|
|
|
|
|
|
|
|
|
|
if (conf->assign_hook) |
|
|
|
if (conf->assign_hook) |
|
|
|
if (!(*conf->assign_hook) (conf->reset_val, true, false)) |
|
|
|
if (!(*conf->assign_hook) (conf->reset_val, true, false)) |
|
|
|
fprintf(stderr, "Failed to initialize %s to %d\n", |
|
|
|
elog(FATAL, "failed to initialize %s to %d", |
|
|
|
conf->gen.name, (int) conf->reset_val); |
|
|
|
conf->gen.name, (int) conf->reset_val); |
|
|
|
*conf->variable = conf->reset_val; |
|
|
|
*conf->variable = conf->reset_val; |
|
|
|
conf->session_val = conf->reset_val; |
|
|
|
conf->session_val = conf->reset_val; |
|
|
|
break; |
|
|
|
break; |
|
|
|
@ -1728,8 +1725,8 @@ InitializeGUCOptions(void) |
|
|
|
strcmp(conf->gen.name, "log_min_duration_statement") == 0); |
|
|
|
strcmp(conf->gen.name, "log_min_duration_statement") == 0); |
|
|
|
if (conf->assign_hook) |
|
|
|
if (conf->assign_hook) |
|
|
|
if (!(*conf->assign_hook) (conf->reset_val, true, false)) |
|
|
|
if (!(*conf->assign_hook) (conf->reset_val, true, false)) |
|
|
|
fprintf(stderr, "Failed to initialize %s to %d\n", |
|
|
|
elog(FATAL, "failed to initialize %s to %d", |
|
|
|
conf->gen.name, conf->reset_val); |
|
|
|
conf->gen.name, conf->reset_val); |
|
|
|
*conf->variable = conf->reset_val; |
|
|
|
*conf->variable = conf->reset_val; |
|
|
|
conf->session_val = conf->reset_val; |
|
|
|
conf->session_val = conf->reset_val; |
|
|
|
break; |
|
|
|
break; |
|
|
|
@ -1743,8 +1740,8 @@ InitializeGUCOptions(void) |
|
|
|
Assert(conf->gen.context != PGC_USERLIMIT); |
|
|
|
Assert(conf->gen.context != PGC_USERLIMIT); |
|
|
|
if (conf->assign_hook) |
|
|
|
if (conf->assign_hook) |
|
|
|
if (!(*conf->assign_hook) (conf->reset_val, true, false)) |
|
|
|
if (!(*conf->assign_hook) (conf->reset_val, true, false)) |
|
|
|
fprintf(stderr, "Failed to initialize %s to %g\n", |
|
|
|
elog(FATAL, "failed to initialize %s to %g", |
|
|
|
conf->gen.name, conf->reset_val); |
|
|
|
conf->gen.name, conf->reset_val); |
|
|
|
*conf->variable = conf->reset_val; |
|
|
|
*conf->variable = conf->reset_val; |
|
|
|
conf->session_val = conf->reset_val; |
|
|
|
conf->session_val = conf->reset_val; |
|
|
|
break; |
|
|
|
break; |
|
|
|
@ -1772,7 +1769,9 @@ InitializeGUCOptions(void) |
|
|
|
|
|
|
|
|
|
|
|
str = strdup(conf->boot_val); |
|
|
|
str = strdup(conf->boot_val); |
|
|
|
if (str == NULL) |
|
|
|
if (str == NULL) |
|
|
|
elog(PANIC, "out of memory"); |
|
|
|
ereport(FATAL, |
|
|
|
|
|
|
|
(errcode(ERRCODE_OUT_OF_MEMORY), |
|
|
|
|
|
|
|
errmsg("out of memory"))); |
|
|
|
conf->reset_val = str; |
|
|
|
conf->reset_val = str; |
|
|
|
|
|
|
|
|
|
|
|
if (conf->assign_hook) |
|
|
|
if (conf->assign_hook) |
|
|
|
@ -1782,8 +1781,8 @@ InitializeGUCOptions(void) |
|
|
|
newstr = (*conf->assign_hook) (str, true, false); |
|
|
|
newstr = (*conf->assign_hook) (str, true, false); |
|
|
|
if (newstr == NULL) |
|
|
|
if (newstr == NULL) |
|
|
|
{ |
|
|
|
{ |
|
|
|
fprintf(stderr, "Failed to initialize %s to '%s'\n", |
|
|
|
elog(FATAL, "failed to initialize %s to \"%s\"", |
|
|
|
conf->gen.name, str); |
|
|
|
conf->gen.name, str); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (newstr != str) |
|
|
|
else if (newstr != str) |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -1874,7 +1873,7 @@ ResetAllOptions(void) |
|
|
|
|
|
|
|
|
|
|
|
if (conf->assign_hook) |
|
|
|
if (conf->assign_hook) |
|
|
|
if (!(*conf->assign_hook) (conf->reset_val, true, true)) |
|
|
|
if (!(*conf->assign_hook) (conf->reset_val, true, true)) |
|
|
|
elog(ERROR, "Failed to reset %s", conf->gen.name); |
|
|
|
elog(ERROR, "failed to reset %s", conf->gen.name); |
|
|
|
*conf->variable = conf->reset_val; |
|
|
|
*conf->variable = conf->reset_val; |
|
|
|
conf->tentative_val = conf->reset_val; |
|
|
|
conf->tentative_val = conf->reset_val; |
|
|
|
conf->gen.source = conf->gen.reset_source; |
|
|
|
conf->gen.source = conf->gen.reset_source; |
|
|
|
@ -1889,7 +1888,7 @@ ResetAllOptions(void) |
|
|
|
|
|
|
|
|
|
|
|
if (conf->assign_hook) |
|
|
|
if (conf->assign_hook) |
|
|
|
if (!(*conf->assign_hook) (conf->reset_val, true, true)) |
|
|
|
if (!(*conf->assign_hook) (conf->reset_val, true, true)) |
|
|
|
elog(ERROR, "Failed to reset %s", conf->gen.name); |
|
|
|
elog(ERROR, "failed to reset %s", conf->gen.name); |
|
|
|
*conf->variable = conf->reset_val; |
|
|
|
*conf->variable = conf->reset_val; |
|
|
|
conf->tentative_val = conf->reset_val; |
|
|
|
conf->tentative_val = conf->reset_val; |
|
|
|
conf->gen.source = conf->gen.reset_source; |
|
|
|
conf->gen.source = conf->gen.reset_source; |
|
|
|
@ -1904,7 +1903,7 @@ ResetAllOptions(void) |
|
|
|
|
|
|
|
|
|
|
|
if (conf->assign_hook) |
|
|
|
if (conf->assign_hook) |
|
|
|
if (!(*conf->assign_hook) (conf->reset_val, true, true)) |
|
|
|
if (!(*conf->assign_hook) (conf->reset_val, true, true)) |
|
|
|
elog(ERROR, "Failed to reset %s", conf->gen.name); |
|
|
|
elog(ERROR, "failed to reset %s", conf->gen.name); |
|
|
|
*conf->variable = conf->reset_val; |
|
|
|
*conf->variable = conf->reset_val; |
|
|
|
conf->tentative_val = conf->reset_val; |
|
|
|
conf->tentative_val = conf->reset_val; |
|
|
|
conf->gen.source = conf->gen.reset_source; |
|
|
|
conf->gen.source = conf->gen.reset_source; |
|
|
|
@ -1933,7 +1932,7 @@ ResetAllOptions(void) |
|
|
|
|
|
|
|
|
|
|
|
newstr = (*conf->assign_hook) (str, true, true); |
|
|
|
newstr = (*conf->assign_hook) (str, true, true); |
|
|
|
if (newstr == NULL) |
|
|
|
if (newstr == NULL) |
|
|
|
elog(ERROR, "Failed to reset %s", conf->gen.name); |
|
|
|
elog(ERROR, "failed to reset %s", conf->gen.name); |
|
|
|
else if (newstr != str) |
|
|
|
else if (newstr != str) |
|
|
|
{ |
|
|
|
{ |
|
|
|
/*
|
|
|
|
/*
|
|
|
|
@ -1972,7 +1971,7 @@ AtEOXact_GUC(bool isCommit) |
|
|
|
if (!guc_dirty) |
|
|
|
if (!guc_dirty) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
/* Prevent memory leak if elog during an assign_hook */ |
|
|
|
/* Prevent memory leak if ereport during an assign_hook */ |
|
|
|
if (guc_string_workspace) |
|
|
|
if (guc_string_workspace) |
|
|
|
{ |
|
|
|
{ |
|
|
|
free(guc_string_workspace); |
|
|
|
free(guc_string_workspace); |
|
|
|
@ -2007,7 +2006,8 @@ AtEOXact_GUC(bool isCommit) |
|
|
|
if (conf->assign_hook) |
|
|
|
if (conf->assign_hook) |
|
|
|
if (!(*conf->assign_hook) (conf->session_val, |
|
|
|
if (!(*conf->assign_hook) (conf->session_val, |
|
|
|
true, false)) |
|
|
|
true, false)) |
|
|
|
elog(LOG, "Failed to commit %s", conf->gen.name); |
|
|
|
elog(LOG, "failed to commit %s", |
|
|
|
|
|
|
|
conf->gen.name); |
|
|
|
*conf->variable = conf->session_val; |
|
|
|
*conf->variable = conf->session_val; |
|
|
|
changed = true; |
|
|
|
changed = true; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -2030,7 +2030,8 @@ AtEOXact_GUC(bool isCommit) |
|
|
|
if (conf->assign_hook) |
|
|
|
if (conf->assign_hook) |
|
|
|
if (!(*conf->assign_hook) (conf->session_val, |
|
|
|
if (!(*conf->assign_hook) (conf->session_val, |
|
|
|
true, false)) |
|
|
|
true, false)) |
|
|
|
elog(LOG, "Failed to commit %s", conf->gen.name); |
|
|
|
elog(LOG, "failed to commit %s", |
|
|
|
|
|
|
|
conf->gen.name); |
|
|
|
*conf->variable = conf->session_val; |
|
|
|
*conf->variable = conf->session_val; |
|
|
|
changed = true; |
|
|
|
changed = true; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -2053,7 +2054,8 @@ AtEOXact_GUC(bool isCommit) |
|
|
|
if (conf->assign_hook) |
|
|
|
if (conf->assign_hook) |
|
|
|
if (!(*conf->assign_hook) (conf->session_val, |
|
|
|
if (!(*conf->assign_hook) (conf->session_val, |
|
|
|
true, false)) |
|
|
|
true, false)) |
|
|
|
elog(LOG, "Failed to commit %s", conf->gen.name); |
|
|
|
elog(LOG, "failed to commit %s", |
|
|
|
|
|
|
|
conf->gen.name); |
|
|
|
*conf->variable = conf->session_val; |
|
|
|
*conf->variable = conf->session_val; |
|
|
|
changed = true; |
|
|
|
changed = true; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -2084,7 +2086,8 @@ AtEOXact_GUC(bool isCommit) |
|
|
|
|
|
|
|
|
|
|
|
newstr = (*conf->assign_hook) (str, true, false); |
|
|
|
newstr = (*conf->assign_hook) (str, true, false); |
|
|
|
if (newstr == NULL) |
|
|
|
if (newstr == NULL) |
|
|
|
elog(LOG, "Failed to commit %s", conf->gen.name); |
|
|
|
elog(LOG, "failed to commit %s", |
|
|
|
|
|
|
|
conf->gen.name); |
|
|
|
else if (newstr != str) |
|
|
|
else if (newstr != str) |
|
|
|
{ |
|
|
|
{ |
|
|
|
/*
|
|
|
|
/*
|
|
|
|
@ -2287,10 +2290,10 @@ parse_real(const char *value, double *result) |
|
|
|
* the checks to see if it would work. |
|
|
|
* the checks to see if it would work. |
|
|
|
* |
|
|
|
* |
|
|
|
* If there is an error (non-existing option, invalid value) then an |
|
|
|
* If there is an error (non-existing option, invalid value) then an |
|
|
|
* elog(ERROR) is thrown *unless* this is called in a context where we |
|
|
|
* ereport(ERROR) is thrown *unless* this is called in a context where we |
|
|
|
* don't want to elog (currently, startup or SIGHUP config file reread). |
|
|
|
* don't want to ereport (currently, startup or SIGHUP config file reread). |
|
|
|
* In that case we write a suitable error message via elog(DEBUG) and |
|
|
|
* In that case we write a suitable error message via ereport(DEBUG) and |
|
|
|
* return false. This is working around the deficiencies in the elog |
|
|
|
* return false. This is working around the deficiencies in the ereport |
|
|
|
* mechanism, so don't blame me. In all other cases, the function |
|
|
|
* mechanism, so don't blame me. In all other cases, the function |
|
|
|
* returns true, including cases where the input is valid but we chose |
|
|
|
* returns true, including cases where the input is valid but we chose |
|
|
|
* not to apply it because of context or source-priority considerations. |
|
|
|
* not to apply it because of context or source-priority considerations. |
|
|
|
@ -2318,7 +2321,9 @@ set_config_option(const char *name, const char *value, |
|
|
|
record = find_option(name); |
|
|
|
record = find_option(name); |
|
|
|
if (record == NULL) |
|
|
|
if (record == NULL) |
|
|
|
{ |
|
|
|
{ |
|
|
|
elog(elevel, "'%s' is not a valid option name", name); |
|
|
|
ereport(elevel, |
|
|
|
|
|
|
|
(errcode(ERRCODE_UNDEFINED_OBJECT), |
|
|
|
|
|
|
|
errmsg("\"%s\" is not a recognized option", name))); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -2335,8 +2340,10 @@ set_config_option(const char *name, const char *value, |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
if (context != PGC_INTERNAL) |
|
|
|
if (context != PGC_INTERNAL) |
|
|
|
{ |
|
|
|
{ |
|
|
|
elog(elevel, "'%s' cannot be changed", |
|
|
|
ereport(elevel, |
|
|
|
name); |
|
|
|
(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM), |
|
|
|
|
|
|
|
errmsg("\"%s\" cannot be changed", |
|
|
|
|
|
|
|
name))); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
@ -2345,15 +2352,20 @@ set_config_option(const char *name, const char *value, |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
if (context != PGC_POSTMASTER) |
|
|
|
if (context != PGC_POSTMASTER) |
|
|
|
{ |
|
|
|
{ |
|
|
|
elog(elevel, "'%s' cannot be changed after server start", |
|
|
|
ereport(elevel, |
|
|
|
name); |
|
|
|
(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM), |
|
|
|
|
|
|
|
errmsg("\"%s\" cannot be changed after server start", |
|
|
|
|
|
|
|
name))); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case PGC_SIGHUP: |
|
|
|
case PGC_SIGHUP: |
|
|
|
if (context != PGC_SIGHUP && context != PGC_POSTMASTER) |
|
|
|
if (context != PGC_SIGHUP && context != PGC_POSTMASTER) |
|
|
|
{ |
|
|
|
{ |
|
|
|
elog(elevel, "'%s' cannot be changed now", name); |
|
|
|
ereport(elevel, |
|
|
|
|
|
|
|
(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM), |
|
|
|
|
|
|
|
errmsg("\"%s\" cannot be changed now", |
|
|
|
|
|
|
|
name))); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -2380,19 +2392,26 @@ set_config_option(const char *name, const char *value, |
|
|
|
} |
|
|
|
} |
|
|
|
else if (context != PGC_BACKEND && context != PGC_POSTMASTER) |
|
|
|
else if (context != PGC_BACKEND && context != PGC_POSTMASTER) |
|
|
|
{ |
|
|
|
{ |
|
|
|
elog(elevel, "'%s' cannot be set after connection start", |
|
|
|
ereport(elevel, |
|
|
|
name); |
|
|
|
(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM), |
|
|
|
|
|
|
|
errmsg("\"%s\" cannot be set after connection start", |
|
|
|
|
|
|
|
name))); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case PGC_SUSET: |
|
|
|
case PGC_SUSET: |
|
|
|
if (context == PGC_USERSET || context == PGC_BACKEND) |
|
|
|
if (context == PGC_USERSET || context == PGC_BACKEND) |
|
|
|
{ |
|
|
|
{ |
|
|
|
elog(elevel, "'%s': permission denied", name); |
|
|
|
ereport(elevel, |
|
|
|
|
|
|
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), |
|
|
|
|
|
|
|
errmsg("\"%s\": permission denied", |
|
|
|
|
|
|
|
name))); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case PGC_USERLIMIT: /* USERLIMIT permissions checked below */ |
|
|
|
case PGC_USERLIMIT: |
|
|
|
|
|
|
|
/* USERLIMIT permissions checked below */ |
|
|
|
|
|
|
|
break; |
|
|
|
case PGC_USERSET: |
|
|
|
case PGC_USERSET: |
|
|
|
/* always okay */ |
|
|
|
/* always okay */ |
|
|
|
break; |
|
|
|
break; |
|
|
|
@ -2420,7 +2439,7 @@ set_config_option(const char *name, const char *value, |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (DoIt && !makeDefault) |
|
|
|
if (DoIt && !makeDefault) |
|
|
|
{ |
|
|
|
{ |
|
|
|
elog(DEBUG3, "%s: setting ignored because previous source is higher priority", |
|
|
|
elog(DEBUG3, "\"%s\": setting ignored because previous source is higher priority", |
|
|
|
name); |
|
|
|
name); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -2441,8 +2460,10 @@ set_config_option(const char *name, const char *value, |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!parse_bool(value, &newval)) |
|
|
|
if (!parse_bool(value, &newval)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
elog(elevel, "option '%s' requires a boolean value", |
|
|
|
ereport(elevel, |
|
|
|
name); |
|
|
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), |
|
|
|
|
|
|
|
errmsg("\"%s\" requires a boolean value", |
|
|
|
|
|
|
|
name))); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
/* Limit non-super user changes */ |
|
|
|
/* Limit non-super user changes */ |
|
|
|
@ -2451,9 +2472,11 @@ set_config_option(const char *name, const char *value, |
|
|
|
newval < conf->session_val && |
|
|
|
newval < conf->session_val && |
|
|
|
!superuser()) |
|
|
|
!superuser()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
elog(elevel, "'%s': permission denied\n" |
|
|
|
ereport(elevel, |
|
|
|
"Only super-users can set this value to false.", |
|
|
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), |
|
|
|
name); |
|
|
|
errmsg("\"%s\": permission denied", |
|
|
|
|
|
|
|
name), |
|
|
|
|
|
|
|
errhint("Must be superuser to change this value to false."))); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
/* Allow admin to override non-super user setting */ |
|
|
|
/* Allow admin to override non-super user setting */ |
|
|
|
@ -2473,8 +2496,10 @@ set_config_option(const char *name, const char *value, |
|
|
|
if (conf->assign_hook) |
|
|
|
if (conf->assign_hook) |
|
|
|
if (!(*conf->assign_hook) (newval, DoIt, interactive)) |
|
|
|
if (!(*conf->assign_hook) (newval, DoIt, interactive)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
elog(elevel, "invalid value for option '%s': %d", |
|
|
|
ereport(elevel, |
|
|
|
name, (int) newval); |
|
|
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), |
|
|
|
|
|
|
|
errmsg("invalid value for \"%s\": %d", |
|
|
|
|
|
|
|
name, (int) newval))); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -2523,28 +2548,32 @@ set_config_option(const char *name, const char *value, |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!parse_int(value, &newval)) |
|
|
|
if (!parse_int(value, &newval)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
elog(elevel, "option '%s' expects an integer value", |
|
|
|
ereport(elevel, |
|
|
|
name); |
|
|
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), |
|
|
|
|
|
|
|
errmsg("\"%s\" requires an integer value", |
|
|
|
|
|
|
|
name))); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
if (newval < conf->min || newval > conf->max) |
|
|
|
if (newval < conf->min || newval > conf->max) |
|
|
|
{ |
|
|
|
{ |
|
|
|
elog(elevel, "option '%s' value %d is outside" |
|
|
|
ereport(elevel, |
|
|
|
" of permissible range [%d .. %d]", |
|
|
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), |
|
|
|
name, newval, conf->min, conf->max); |
|
|
|
errmsg("%d is outside the valid range for \"%s\" (%d .. %d)", |
|
|
|
|
|
|
|
newval, name, conf->min, conf->max))); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
/* Limit non-super user changes */ |
|
|
|
/* Limit non-super user changes */ |
|
|
|
if (record->context == PGC_USERLIMIT && |
|
|
|
if (record->context == PGC_USERLIMIT && |
|
|
|
source > PGC_S_USERSTART && |
|
|
|
source > PGC_S_USERSTART && |
|
|
|
conf->session_val != 0 && |
|
|
|
conf->session_val != 0 && |
|
|
|
(newval > conf->session_val || |
|
|
|
(newval > conf->session_val || newval == 0) && |
|
|
|
newval == 0) && |
|
|
|
|
|
|
|
!superuser()) |
|
|
|
!superuser()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
elog(elevel, "'%s': permission denied\n" |
|
|
|
ereport(elevel, |
|
|
|
"Only super-users can increase this value " |
|
|
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), |
|
|
|
"or set it to zero.", name); |
|
|
|
errmsg("\"%s\": permission denied", |
|
|
|
|
|
|
|
name), |
|
|
|
|
|
|
|
errhint("Must be superuser to increase this value or set it to zero."))); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
/* Allow admin to override non-super user setting */ |
|
|
|
/* Allow admin to override non-super user setting */ |
|
|
|
@ -2564,8 +2593,10 @@ set_config_option(const char *name, const char *value, |
|
|
|
if (conf->assign_hook) |
|
|
|
if (conf->assign_hook) |
|
|
|
if (!(*conf->assign_hook) (newval, DoIt, interactive)) |
|
|
|
if (!(*conf->assign_hook) (newval, DoIt, interactive)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
elog(elevel, "invalid value for option '%s': %d", |
|
|
|
ereport(elevel, |
|
|
|
name, newval); |
|
|
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), |
|
|
|
|
|
|
|
errmsg("invalid value for \"%s\": %d", |
|
|
|
|
|
|
|
name, newval))); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -2614,15 +2645,18 @@ set_config_option(const char *name, const char *value, |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!parse_real(value, &newval)) |
|
|
|
if (!parse_real(value, &newval)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
elog(elevel, "option '%s' expects a real number", |
|
|
|
ereport(elevel, |
|
|
|
name); |
|
|
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), |
|
|
|
|
|
|
|
errmsg("\"%s\" requires a numeric value", |
|
|
|
|
|
|
|
name))); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
if (newval < conf->min || newval > conf->max) |
|
|
|
if (newval < conf->min || newval > conf->max) |
|
|
|
{ |
|
|
|
{ |
|
|
|
elog(elevel, "option '%s' value %g is outside" |
|
|
|
ereport(elevel, |
|
|
|
" of permissible range [%g .. %g]", |
|
|
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), |
|
|
|
name, newval, conf->min, conf->max); |
|
|
|
errmsg("%g is outside the valid range for \"%s\" (%g .. %g)", |
|
|
|
|
|
|
|
newval, name, conf->min, conf->max))); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
/* Limit non-super user changes */ |
|
|
|
/* Limit non-super user changes */ |
|
|
|
@ -2631,9 +2665,11 @@ set_config_option(const char *name, const char *value, |
|
|
|
newval > conf->session_val && |
|
|
|
newval > conf->session_val && |
|
|
|
!superuser()) |
|
|
|
!superuser()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
elog(elevel, "'%s': permission denied\n" |
|
|
|
ereport(elevel, |
|
|
|
"Only super-users can increase this value.", |
|
|
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), |
|
|
|
name); |
|
|
|
errmsg("\"%s\": permission denied", |
|
|
|
|
|
|
|
name), |
|
|
|
|
|
|
|
errhint("Must be superuser to increase this value."))); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
/* Allow admin to override non-super user setting */ |
|
|
|
/* Allow admin to override non-super user setting */ |
|
|
|
@ -2653,8 +2689,10 @@ set_config_option(const char *name, const char *value, |
|
|
|
if (conf->assign_hook) |
|
|
|
if (conf->assign_hook) |
|
|
|
if (!(*conf->assign_hook) (newval, DoIt, interactive)) |
|
|
|
if (!(*conf->assign_hook) (newval, DoIt, interactive)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
elog(elevel, "invalid value for option '%s': %g", |
|
|
|
ereport(elevel, |
|
|
|
name, newval); |
|
|
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), |
|
|
|
|
|
|
|
errmsg("invalid value for \"%s\": %g", |
|
|
|
|
|
|
|
name, newval))); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -2704,7 +2742,9 @@ set_config_option(const char *name, const char *value, |
|
|
|
newval = strdup(value); |
|
|
|
newval = strdup(value); |
|
|
|
if (newval == NULL) |
|
|
|
if (newval == NULL) |
|
|
|
{ |
|
|
|
{ |
|
|
|
elog(elevel, "out of memory"); |
|
|
|
ereport(elevel, |
|
|
|
|
|
|
|
(errcode(ERRCODE_OUT_OF_MEMORY), |
|
|
|
|
|
|
|
errmsg("out of memory"))); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -2720,9 +2760,11 @@ set_config_option(const char *name, const char *value, |
|
|
|
new_int_value > old_int_value && |
|
|
|
new_int_value > old_int_value && |
|
|
|
!superuser()) |
|
|
|
!superuser()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
elog(elevel, "'%s': permission denied\n" |
|
|
|
ereport(elevel, |
|
|
|
"Only super-users can increase this value.", |
|
|
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), |
|
|
|
name); |
|
|
|
errmsg("\"%s\": permission denied", |
|
|
|
|
|
|
|
name), |
|
|
|
|
|
|
|
errhint("Must be superuser to increase this value."))); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
/* Allow admin to override non-super user setting */ |
|
|
|
/* Allow admin to override non-super user setting */ |
|
|
|
@ -2744,7 +2786,9 @@ set_config_option(const char *name, const char *value, |
|
|
|
newval = strdup(conf->reset_val); |
|
|
|
newval = strdup(conf->reset_val); |
|
|
|
if (newval == NULL) |
|
|
|
if (newval == NULL) |
|
|
|
{ |
|
|
|
{ |
|
|
|
elog(elevel, "out of memory"); |
|
|
|
ereport(elevel, |
|
|
|
|
|
|
|
(errcode(ERRCODE_OUT_OF_MEMORY), |
|
|
|
|
|
|
|
errmsg("out of memory"))); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
source = conf->gen.reset_source; |
|
|
|
source = conf->gen.reset_source; |
|
|
|
@ -2757,7 +2801,7 @@ set_config_option(const char *name, const char *value, |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Remember string in workspace, so that we can free it |
|
|
|
* Remember string in workspace, so that we can free it |
|
|
|
* and avoid a permanent memory leak if hook elogs. |
|
|
|
* and avoid a permanent memory leak if hook ereports. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
if (guc_string_workspace) |
|
|
|
if (guc_string_workspace) |
|
|
|
free(guc_string_workspace); |
|
|
|
free(guc_string_workspace); |
|
|
|
@ -2773,8 +2817,10 @@ set_config_option(const char *name, const char *value, |
|
|
|
if (hookresult == NULL) |
|
|
|
if (hookresult == NULL) |
|
|
|
{ |
|
|
|
{ |
|
|
|
free(newval); |
|
|
|
free(newval); |
|
|
|
elog(elevel, "invalid value for option '%s': '%s'", |
|
|
|
ereport(elevel, |
|
|
|
name, value ? value : ""); |
|
|
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), |
|
|
|
|
|
|
|
errmsg("invalid value for \"%s\": \"%s\"", |
|
|
|
|
|
|
|
name, value ? value : ""))); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
else if (hookresult != newval) |
|
|
|
else if (hookresult != newval) |
|
|
|
@ -2864,7 +2910,7 @@ SetConfigOption(const char *name, const char *value, |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Fetch the current value of the option `name'. If the option doesn't exist, |
|
|
|
* Fetch the current value of the option `name'. If the option doesn't exist, |
|
|
|
* throw an elog and don't return. |
|
|
|
* throw an ereport and don't return. |
|
|
|
* |
|
|
|
* |
|
|
|
* The string is *not* allocated for modification and is really only |
|
|
|
* The string is *not* allocated for modification and is really only |
|
|
|
* valid until the next call to configuration related functions. |
|
|
|
* valid until the next call to configuration related functions. |
|
|
|
@ -2877,7 +2923,9 @@ GetConfigOption(const char *name) |
|
|
|
|
|
|
|
|
|
|
|
record = find_option(name); |
|
|
|
record = find_option(name); |
|
|
|
if (record == NULL) |
|
|
|
if (record == NULL) |
|
|
|
elog(ERROR, "Option '%s' is not recognized", name); |
|
|
|
ereport(ERROR, |
|
|
|
|
|
|
|
(errcode(ERRCODE_UNDEFINED_OBJECT), |
|
|
|
|
|
|
|
errmsg("\"%s\" is not a recognized option", name))); |
|
|
|
|
|
|
|
|
|
|
|
switch (record->vartype) |
|
|
|
switch (record->vartype) |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -2911,7 +2959,9 @@ GetConfigOptionResetString(const char *name) |
|
|
|
|
|
|
|
|
|
|
|
record = find_option(name); |
|
|
|
record = find_option(name); |
|
|
|
if (record == NULL) |
|
|
|
if (record == NULL) |
|
|
|
elog(ERROR, "Option '%s' is not recognized", name); |
|
|
|
ereport(ERROR, |
|
|
|
|
|
|
|
(errcode(ERRCODE_UNDEFINED_OBJECT), |
|
|
|
|
|
|
|
errmsg("\"%s\" is not a recognized option", name))); |
|
|
|
|
|
|
|
|
|
|
|
switch (record->vartype) |
|
|
|
switch (record->vartype) |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -2965,14 +3015,18 @@ flatten_set_variable_args(const char *name, List *args) |
|
|
|
/* Else get flags for the variable */ |
|
|
|
/* Else get flags for the variable */ |
|
|
|
record = find_option(name); |
|
|
|
record = find_option(name); |
|
|
|
if (record == NULL) |
|
|
|
if (record == NULL) |
|
|
|
elog(ERROR, "'%s' is not a valid option name", name); |
|
|
|
ereport(ERROR, |
|
|
|
|
|
|
|
(errcode(ERRCODE_UNDEFINED_OBJECT), |
|
|
|
|
|
|
|
errmsg("\"%s\" is not a recognized option", name))); |
|
|
|
|
|
|
|
|
|
|
|
flags = record->flags; |
|
|
|
flags = record->flags; |
|
|
|
|
|
|
|
|
|
|
|
/* Complain if list input and non-list variable */ |
|
|
|
/* Complain if list input and non-list variable */ |
|
|
|
if ((flags & GUC_LIST_INPUT) == 0 && |
|
|
|
if ((flags & GUC_LIST_INPUT) == 0 && |
|
|
|
lnext(args) != NIL) |
|
|
|
lnext(args) != NIL) |
|
|
|
elog(ERROR, "SET %s takes only one argument", name); |
|
|
|
ereport(ERROR, |
|
|
|
|
|
|
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), |
|
|
|
|
|
|
|
errmsg("SET %s takes only one argument", name))); |
|
|
|
|
|
|
|
|
|
|
|
initStringInfo(&buf); |
|
|
|
initStringInfo(&buf); |
|
|
|
|
|
|
|
|
|
|
|
@ -2985,7 +3039,7 @@ flatten_set_variable_args(const char *name, List *args) |
|
|
|
appendStringInfo(&buf, ", "); |
|
|
|
appendStringInfo(&buf, ", "); |
|
|
|
|
|
|
|
|
|
|
|
if (!IsA(arg, A_Const)) |
|
|
|
if (!IsA(arg, A_Const)) |
|
|
|
elog(ERROR, "flatten_set_variable_args: unexpected input"); |
|
|
|
elog(ERROR, "unrecognized node type: %d", (int) nodeTag(arg)); |
|
|
|
|
|
|
|
|
|
|
|
switch (nodeTag(&arg->val)) |
|
|
|
switch (nodeTag(&arg->val)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -3034,7 +3088,8 @@ flatten_set_variable_args(const char *name, List *args) |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
elog(ERROR, "flatten_set_variable_args: unexpected input"); |
|
|
|
elog(ERROR, "unrecognized node type: %d", |
|
|
|
|
|
|
|
(int) nodeTag(&arg->val)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -3073,7 +3128,9 @@ set_config_by_name(PG_FUNCTION_ARGS) |
|
|
|
text *result_text; |
|
|
|
text *result_text; |
|
|
|
|
|
|
|
|
|
|
|
if (PG_ARGISNULL(0)) |
|
|
|
if (PG_ARGISNULL(0)) |
|
|
|
elog(ERROR, "SET variable name is required"); |
|
|
|
ereport(ERROR, |
|
|
|
|
|
|
|
(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), |
|
|
|
|
|
|
|
errmsg("SET variable name is required"))); |
|
|
|
|
|
|
|
|
|
|
|
/* Get the GUC variable name */ |
|
|
|
/* Get the GUC variable name */ |
|
|
|
name = DatumGetCString(DirectFunctionCall1(textout, PG_GETARG_DATUM(0))); |
|
|
|
name = DatumGetCString(DirectFunctionCall1(textout, PG_GETARG_DATUM(0))); |
|
|
|
@ -3252,7 +3309,9 @@ GetConfigOptionByName(const char *name, const char **varname) |
|
|
|
|
|
|
|
|
|
|
|
record = find_option(name); |
|
|
|
record = find_option(name); |
|
|
|
if (record == NULL) |
|
|
|
if (record == NULL) |
|
|
|
elog(ERROR, "Option '%s' is not recognized", name); |
|
|
|
ereport(ERROR, |
|
|
|
|
|
|
|
(errcode(ERRCODE_UNDEFINED_OBJECT), |
|
|
|
|
|
|
|
errmsg("\"%s\" is not a recognized option", name))); |
|
|
|
|
|
|
|
|
|
|
|
if (varname) |
|
|
|
if (varname) |
|
|
|
*varname = record->name; |
|
|
|
*varname = record->name; |
|
|
|
@ -3538,7 +3597,9 @@ write_nondefault_variables(GucContext context) |
|
|
|
filename = malloc(strlen(DataDir) + strlen(CONFIG_EXEC_PARAMS) + 2); |
|
|
|
filename = malloc(strlen(DataDir) + strlen(CONFIG_EXEC_PARAMS) + 2); |
|
|
|
if (new_filename == NULL || filename == NULL) |
|
|
|
if (new_filename == NULL || filename == NULL) |
|
|
|
{ |
|
|
|
{ |
|
|
|
elog(elevel, "out of memory"); |
|
|
|
ereport(elevel, |
|
|
|
|
|
|
|
(errcode(ERRCODE_OUT_OF_MEMORY), |
|
|
|
|
|
|
|
errmsg("out of memory"))); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
sprintf(new_filename, "%s/" CONFIG_EXEC_PARAMS ".new", DataDir); |
|
|
|
sprintf(new_filename, "%s/" CONFIG_EXEC_PARAMS ".new", DataDir); |
|
|
|
@ -3549,8 +3610,10 @@ write_nondefault_variables(GucContext context) |
|
|
|
{ |
|
|
|
{ |
|
|
|
free(new_filename); |
|
|
|
free(new_filename); |
|
|
|
free(filename); |
|
|
|
free(filename); |
|
|
|
elog(elevel, "could not write exec config params file `" |
|
|
|
ereport(elevel, |
|
|
|
CONFIG_EXEC_PARAMS "': %s", strerror(errno)); |
|
|
|
(errcode_for_file_access(), |
|
|
|
|
|
|
|
errmsg("could not write exec config params file \"" |
|
|
|
|
|
|
|
CONFIG_EXEC_PARAMS "\": %m"))); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -3613,7 +3676,6 @@ write_nondefault_variables(GucContext context) |
|
|
|
rename(new_filename, filename); |
|
|
|
rename(new_filename, filename); |
|
|
|
free(new_filename); |
|
|
|
free(new_filename); |
|
|
|
free(filename); |
|
|
|
free(filename); |
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -3637,7 +3699,7 @@ read_string_with_null(FILE *fp) |
|
|
|
if (i == 0) |
|
|
|
if (i == 0) |
|
|
|
return NULL; |
|
|
|
return NULL; |
|
|
|
else |
|
|
|
else |
|
|
|
elog(FATAL, "Invalid format of exec config params file"); |
|
|
|
elog(FATAL, "invalid format of exec config params file"); |
|
|
|
} |
|
|
|
} |
|
|
|
if (i == 0) |
|
|
|
if (i == 0) |
|
|
|
str = malloc(maxlen); |
|
|
|
str = malloc(maxlen); |
|
|
|
@ -3671,7 +3733,9 @@ read_nondefault_variables(void) |
|
|
|
filename = malloc(strlen(DataDir) + strlen(CONFIG_EXEC_PARAMS) + 2); |
|
|
|
filename = malloc(strlen(DataDir) + strlen(CONFIG_EXEC_PARAMS) + 2); |
|
|
|
if (filename == NULL) |
|
|
|
if (filename == NULL) |
|
|
|
{ |
|
|
|
{ |
|
|
|
elog(ERROR, "out of memory"); |
|
|
|
ereport(ERROR, |
|
|
|
|
|
|
|
(errcode(ERRCODE_OUT_OF_MEMORY), |
|
|
|
|
|
|
|
errmsg("out of memory"))); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
sprintf(filename, "%s/" CONFIG_EXEC_PARAMS, DataDir); |
|
|
|
sprintf(filename, "%s/" CONFIG_EXEC_PARAMS, DataDir); |
|
|
|
@ -3682,20 +3746,22 @@ read_nondefault_variables(void) |
|
|
|
free(filename); |
|
|
|
free(filename); |
|
|
|
/* File not found is fine */ |
|
|
|
/* File not found is fine */ |
|
|
|
if (errno != ENOENT) |
|
|
|
if (errno != ENOENT) |
|
|
|
elog(FATAL, "could not read exec config params file `" |
|
|
|
ereport(FATAL, |
|
|
|
CONFIG_EXEC_PARAMS "': %s", strerror(errno)); |
|
|
|
(errcode_for_file_access(), |
|
|
|
|
|
|
|
errmsg("could not read exec config params file \"" |
|
|
|
|
|
|
|
CONFIG_EXEC_PARAMS "\": %m"))); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
while (1) |
|
|
|
for (;;) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if ((varname = read_string_with_null(fp)) == NULL) |
|
|
|
if ((varname = read_string_with_null(fp)) == NULL) |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
if ((varvalue = read_string_with_null(fp)) == NULL) |
|
|
|
if ((varvalue = read_string_with_null(fp)) == NULL) |
|
|
|
elog(FATAL, "Invalid format of exec config params file"); |
|
|
|
elog(FATAL, "invalid format of exec config params file"); |
|
|
|
if (fread(&varsource, sizeof(varsource), 1, fp) == 0) |
|
|
|
if (fread(&varsource, sizeof(varsource), 1, fp) == 0) |
|
|
|
elog(FATAL, "Invalid format of exec config params file"); |
|
|
|
elog(FATAL, "invalid format of exec config params file"); |
|
|
|
|
|
|
|
|
|
|
|
(void) set_config_option(varname, varvalue, PGC_POSTMASTER, |
|
|
|
(void) set_config_option(varname, varvalue, PGC_POSTMASTER, |
|
|
|
varsource, false, true); |
|
|
|
varsource, false, true); |
|
|
|
@ -3733,20 +3799,26 @@ ParseLongOption(const char *string, char **name, char **value) |
|
|
|
{ |
|
|
|
{ |
|
|
|
*name = malloc(equal_pos + 1); |
|
|
|
*name = malloc(equal_pos + 1); |
|
|
|
if (!*name) |
|
|
|
if (!*name) |
|
|
|
elog(FATAL, "out of memory"); |
|
|
|
ereport(FATAL, |
|
|
|
|
|
|
|
(errcode(ERRCODE_OUT_OF_MEMORY), |
|
|
|
|
|
|
|
errmsg("out of memory"))); |
|
|
|
strncpy(*name, string, equal_pos); |
|
|
|
strncpy(*name, string, equal_pos); |
|
|
|
(*name)[equal_pos] = '\0'; |
|
|
|
(*name)[equal_pos] = '\0'; |
|
|
|
|
|
|
|
|
|
|
|
*value = strdup(&string[equal_pos + 1]); |
|
|
|
*value = strdup(&string[equal_pos + 1]); |
|
|
|
if (!*value) |
|
|
|
if (!*value) |
|
|
|
elog(FATAL, "out of memory"); |
|
|
|
ereport(FATAL, |
|
|
|
|
|
|
|
(errcode(ERRCODE_OUT_OF_MEMORY), |
|
|
|
|
|
|
|
errmsg("out of memory"))); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
/* no equal sign in string */ |
|
|
|
/* no equal sign in string */ |
|
|
|
*name = strdup(string); |
|
|
|
*name = strdup(string); |
|
|
|
if (!*name) |
|
|
|
if (!*name) |
|
|
|
elog(FATAL, "out of memory"); |
|
|
|
ereport(FATAL, |
|
|
|
|
|
|
|
(errcode(ERRCODE_OUT_OF_MEMORY), |
|
|
|
|
|
|
|
errmsg("out of memory"))); |
|
|
|
*value = NULL; |
|
|
|
*value = NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -3794,7 +3866,9 @@ ProcessGUCArray(ArrayType *array, GucSource source) |
|
|
|
ParseLongOption(s, &name, &value); |
|
|
|
ParseLongOption(s, &name, &value); |
|
|
|
if (!value) |
|
|
|
if (!value) |
|
|
|
{ |
|
|
|
{ |
|
|
|
elog(WARNING, "cannot parse setting \"%s\"", name); |
|
|
|
ereport(WARNING, |
|
|
|
|
|
|
|
(errcode(ERRCODE_SYNTAX_ERROR), |
|
|
|
|
|
|
|
errmsg("cannot parse setting for \"%s\"", name))); |
|
|
|
free(name); |
|
|
|
free(name); |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -4139,7 +4213,9 @@ assign_phony_autocommit(bool newval, bool doit, bool interactive) |
|
|
|
if (!newval) |
|
|
|
if (!newval) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (doit && interactive) |
|
|
|
if (doit && interactive) |
|
|
|
elog(ERROR, "SET AUTOCOMMIT TO OFF is no longer supported"); |
|
|
|
ereport(ERROR, |
|
|
|
|
|
|
|
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), |
|
|
|
|
|
|
|
errmsg("SET AUTOCOMMIT TO OFF is no longer supported"))); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|