|
|
|
@ -10,7 +10,7 @@ |
|
|
|
|
* Written by Peter Eisentraut <peter_e@gmx.net>. |
|
|
|
|
* |
|
|
|
|
* IDENTIFICATION |
|
|
|
|
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.151 2003/08/26 15:38:25 tgl Exp $ |
|
|
|
|
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.152 2003/09/01 04:15:50 momjian Exp $ |
|
|
|
|
* |
|
|
|
|
*-------------------------------------------------------------------- |
|
|
|
|
*/ |
|
|
|
@ -2373,7 +2373,7 @@ parse_real(const char *value, double *result) |
|
|
|
|
* properly. |
|
|
|
|
* |
|
|
|
|
* If value is NULL, set the option to its default value. If the |
|
|
|
|
* parameter DoIt is false then don't really set the option but do all |
|
|
|
|
* parameter changeVal is false then don't really set the option but do all |
|
|
|
|
* the checks to see if it would work. |
|
|
|
|
* |
|
|
|
|
* If there is an error (non-existing option, invalid value) then an |
|
|
|
@ -2390,13 +2390,13 @@ parse_real(const char *value, double *result) |
|
|
|
|
bool |
|
|
|
|
set_config_option(const char *name, const char *value, |
|
|
|
|
GucContext context, GucSource source, |
|
|
|
|
bool isLocal, bool DoIt) |
|
|
|
|
bool isLocal, bool changeVal) |
|
|
|
|
{ |
|
|
|
|
struct config_generic *record; |
|
|
|
|
int elevel; |
|
|
|
|
bool interactive; |
|
|
|
|
bool makeDefault; |
|
|
|
|
bool DoIt_orig; |
|
|
|
|
bool changeVal_orig; |
|
|
|
|
|
|
|
|
|
if (context == PGC_SIGHUP || source == PGC_S_DEFAULT) |
|
|
|
|
elevel = DEBUG2; |
|
|
|
@ -2511,26 +2511,26 @@ set_config_option(const char *name, const char *value, |
|
|
|
|
* Should we set reset/session values? (If so, the behavior is not |
|
|
|
|
* transactional.) |
|
|
|
|
*/ |
|
|
|
|
makeDefault = DoIt && (source <= PGC_S_OVERRIDE) && (value != NULL); |
|
|
|
|
makeDefault = changeVal && (source <= PGC_S_OVERRIDE) && (value != NULL); |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Ignore attempted set if overridden by previously processed setting. |
|
|
|
|
* However, if DoIt is false then plow ahead anyway since we are |
|
|
|
|
* However, if changeVal is false then plow ahead anyway since we are |
|
|
|
|
* trying to find out if the value is potentially good, not actually |
|
|
|
|
* use it. Also keep going if makeDefault is true, since we may want |
|
|
|
|
* to set the reset/session values even if we can't set the variable |
|
|
|
|
* itself. |
|
|
|
|
*/ |
|
|
|
|
DoIt_orig = DoIt; /* we might have to reverse this later */ |
|
|
|
|
changeVal_orig = changeVal; /* we might have to reverse this later */ |
|
|
|
|
if (record->source > source) |
|
|
|
|
{ |
|
|
|
|
if (DoIt && !makeDefault) |
|
|
|
|
if (changeVal && !makeDefault) |
|
|
|
|
{ |
|
|
|
|
elog(DEBUG3, "\"%s\": setting ignored because previous source is higher priority", |
|
|
|
|
name); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
DoIt = false; /* we won't change the variable itself */ |
|
|
|
|
changeVal = false; /* we won't change the variable itself */ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ -2572,7 +2572,7 @@ set_config_option(const char *name, const char *value, |
|
|
|
|
record->session_source > PGC_S_UNPRIVILEGED && |
|
|
|
|
newval > conf->session_val && |
|
|
|
|
!superuser()) |
|
|
|
|
DoIt = DoIt_orig; |
|
|
|
|
changeVal = changeVal_orig; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
@ -2581,7 +2581,7 @@ set_config_option(const char *name, const char *value, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (conf->assign_hook) |
|
|
|
|
if (!(*conf->assign_hook) (newval, DoIt, interactive)) |
|
|
|
|
if (!(*conf->assign_hook) (newval, changeVal, interactive)) |
|
|
|
|
{ |
|
|
|
|
ereport(elevel, |
|
|
|
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), |
|
|
|
@ -2590,9 +2590,9 @@ set_config_option(const char *name, const char *value, |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (DoIt || makeDefault) |
|
|
|
|
if (changeVal || makeDefault) |
|
|
|
|
{ |
|
|
|
|
if (DoIt) |
|
|
|
|
if (changeVal) |
|
|
|
|
{ |
|
|
|
|
*conf->variable = newval; |
|
|
|
|
conf->gen.source = source; |
|
|
|
@ -2669,7 +2669,7 @@ set_config_option(const char *name, const char *value, |
|
|
|
|
record->session_source > PGC_S_UNPRIVILEGED && |
|
|
|
|
newval < conf->session_val && |
|
|
|
|
!superuser()) |
|
|
|
|
DoIt = DoIt_orig; |
|
|
|
|
changeVal = changeVal_orig; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
@ -2678,7 +2678,7 @@ set_config_option(const char *name, const char *value, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (conf->assign_hook) |
|
|
|
|
if (!(*conf->assign_hook) (newval, DoIt, interactive)) |
|
|
|
|
if (!(*conf->assign_hook) (newval, changeVal, interactive)) |
|
|
|
|
{ |
|
|
|
|
ereport(elevel, |
|
|
|
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), |
|
|
|
@ -2687,9 +2687,9 @@ set_config_option(const char *name, const char *value, |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (DoIt || makeDefault) |
|
|
|
|
if (changeVal || makeDefault) |
|
|
|
|
{ |
|
|
|
|
if (DoIt) |
|
|
|
|
if (changeVal) |
|
|
|
|
{ |
|
|
|
|
*conf->variable = newval; |
|
|
|
|
conf->gen.source = source; |
|
|
|
@ -2765,7 +2765,7 @@ set_config_option(const char *name, const char *value, |
|
|
|
|
record->session_source > PGC_S_UNPRIVILEGED && |
|
|
|
|
newval < conf->session_val && |
|
|
|
|
!superuser()) |
|
|
|
|
DoIt = DoIt_orig; |
|
|
|
|
changeVal = changeVal_orig; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
@ -2774,7 +2774,7 @@ set_config_option(const char *name, const char *value, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (conf->assign_hook) |
|
|
|
|
if (!(*conf->assign_hook) (newval, DoIt, interactive)) |
|
|
|
|
if (!(*conf->assign_hook) (newval, changeVal, interactive)) |
|
|
|
|
{ |
|
|
|
|
ereport(elevel, |
|
|
|
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), |
|
|
|
@ -2783,9 +2783,9 @@ set_config_option(const char *name, const char *value, |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (DoIt || makeDefault) |
|
|
|
|
if (changeVal || makeDefault) |
|
|
|
|
{ |
|
|
|
|
if (DoIt) |
|
|
|
|
if (changeVal) |
|
|
|
|
{ |
|
|
|
|
*conf->variable = newval; |
|
|
|
|
conf->gen.source = source; |
|
|
|
@ -2863,7 +2863,7 @@ set_config_option(const char *name, const char *value, |
|
|
|
|
record->session_source > PGC_S_UNPRIVILEGED && |
|
|
|
|
newval < conf->session_val && |
|
|
|
|
!superuser()) |
|
|
|
|
DoIt = DoIt_orig; |
|
|
|
|
changeVal = changeVal_orig; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else if (conf->reset_val) |
|
|
|
@ -2902,7 +2902,7 @@ set_config_option(const char *name, const char *value, |
|
|
|
|
const char *hookresult; |
|
|
|
|
|
|
|
|
|
hookresult = (*conf->assign_hook) (newval, |
|
|
|
|
DoIt, interactive); |
|
|
|
|
changeVal, interactive); |
|
|
|
|
guc_string_workspace = NULL; |
|
|
|
|
if (hookresult == NULL) |
|
|
|
|
{ |
|
|
|
@ -2932,9 +2932,9 @@ set_config_option(const char *name, const char *value, |
|
|
|
|
|
|
|
|
|
guc_string_workspace = NULL; |
|
|
|
|
|
|
|
|
|
if (DoIt || makeDefault) |
|
|
|
|
if (changeVal || makeDefault) |
|
|
|
|
{ |
|
|
|
|
if (DoIt) |
|
|
|
|
if (changeVal) |
|
|
|
|
{ |
|
|
|
|
SET_STRING_VARIABLE(conf, newval); |
|
|
|
|
conf->gen.source = source; |
|
|
|
@ -2976,7 +2976,7 @@ set_config_option(const char *name, const char *value, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (DoIt && (record->flags & GUC_REPORT)) |
|
|
|
|
if (changeVal && (record->flags & GUC_REPORT)) |
|
|
|
|
ReportGUCOption(record); |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|