mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef list
provided by Andrew.
This commit is contained in:
@ -10,7 +10,7 @@
|
||||
* Written by Peter Eisentraut <peter_e@gmx.net>.
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.504 2009/05/03 20:09:54 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.505 2009/06/11 14:49:06 momjian Exp $
|
||||
*
|
||||
*--------------------------------------------------------------------
|
||||
*/
|
||||
@ -139,7 +139,7 @@ static const char *assign_log_destination(const char *value,
|
||||
static int syslog_facility = LOG_LOCAL0;
|
||||
|
||||
static bool assign_syslog_facility(int newval,
|
||||
bool doit, GucSource source);
|
||||
bool doit, GucSource source);
|
||||
static const char *assign_syslog_ident(const char *ident,
|
||||
bool doit, GucSource source);
|
||||
#endif
|
||||
@ -169,9 +169,9 @@ static bool assign_autovacuum_max_workers(int newval, bool doit, GucSource sourc
|
||||
static bool assign_effective_io_concurrency(int newval, bool doit, GucSource source);
|
||||
static const char *assign_pgstat_temp_directory(const char *newval, bool doit, GucSource source);
|
||||
|
||||
static char *config_enum_get_options(struct config_enum *record,
|
||||
const char *prefix, const char *suffix,
|
||||
const char *separator);
|
||||
static char *config_enum_get_options(struct config_enum * record,
|
||||
const char *prefix, const char *suffix,
|
||||
const char *separator);
|
||||
|
||||
|
||||
/*
|
||||
@ -242,10 +242,10 @@ static const struct config_enum_entry log_statement_options[] = {
|
||||
};
|
||||
|
||||
static const struct config_enum_entry regex_flavor_options[] = {
|
||||
{"advanced", REG_ADVANCED, false},
|
||||
{"extended", REG_EXTENDED, false},
|
||||
{"basic", REG_BASIC, false},
|
||||
{NULL, 0, false}
|
||||
{"advanced", REG_ADVANCED, false},
|
||||
{"extended", REG_EXTENDED, false},
|
||||
{"basic", REG_BASIC, false},
|
||||
{NULL, 0, false}
|
||||
};
|
||||
|
||||
static const struct config_enum_entry isolation_level_options[] = {
|
||||
@ -1715,11 +1715,11 @@ static struct config_int ConfigureNamesInt[] =
|
||||
{
|
||||
{"effective_io_concurrency",
|
||||
#ifdef USE_PREFETCH
|
||||
PGC_USERSET,
|
||||
PGC_USERSET,
|
||||
#else
|
||||
PGC_INTERNAL,
|
||||
PGC_INTERNAL,
|
||||
#endif
|
||||
RESOURCES,
|
||||
RESOURCES,
|
||||
gettext_noop("Number of simultaneous requests that can be handled efficiently by the disk subsystem."),
|
||||
gettext_noop("For RAID arrays, this should be approximately the number of drive spindles in the array.")
|
||||
},
|
||||
@ -1794,9 +1794,9 @@ static struct config_int ConfigureNamesInt[] =
|
||||
|
||||
{
|
||||
{"segment_size", PGC_INTERNAL, PRESET_OPTIONS,
|
||||
gettext_noop("Shows the number of pages per disk file."),
|
||||
NULL,
|
||||
GUC_UNIT_BLOCKS | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
|
||||
gettext_noop("Shows the number of pages per disk file."),
|
||||
NULL,
|
||||
GUC_UNIT_BLOCKS | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
|
||||
},
|
||||
&segment_size,
|
||||
RELSEG_SIZE, RELSEG_SIZE, RELSEG_SIZE, NULL, NULL
|
||||
@ -1819,8 +1819,8 @@ static struct config_int ConfigureNamesInt[] =
|
||||
GUC_UNIT_XBLOCKS | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
|
||||
},
|
||||
&wal_segment_size,
|
||||
(XLOG_SEG_SIZE / XLOG_BLCKSZ),
|
||||
(XLOG_SEG_SIZE / XLOG_BLCKSZ),
|
||||
(XLOG_SEG_SIZE / XLOG_BLCKSZ),
|
||||
(XLOG_SEG_SIZE / XLOG_BLCKSZ),
|
||||
(XLOG_SEG_SIZE / XLOG_BLCKSZ),
|
||||
NULL, NULL
|
||||
},
|
||||
@ -2562,7 +2562,7 @@ static struct config_enum ConfigureNamesEnum[] =
|
||||
XACT_READ_COMMITTED, isolation_level_options, NULL, NULL
|
||||
},
|
||||
|
||||
{
|
||||
{
|
||||
{"IntervalStyle", PGC_USERSET, CLIENT_CONN_LOCALE,
|
||||
gettext_noop("Sets the display format for interval values."),
|
||||
NULL,
|
||||
@ -2655,7 +2655,7 @@ static struct config_enum ConfigureNamesEnum[] =
|
||||
NULL
|
||||
},
|
||||
&sync_method,
|
||||
DEFAULT_SYNC_METHOD, sync_method_options,
|
||||
DEFAULT_SYNC_METHOD, sync_method_options,
|
||||
assign_xlog_sync_method, NULL
|
||||
},
|
||||
|
||||
@ -2722,7 +2722,7 @@ static int GUCNestLevel = 0; /* 1 when in main transaction */
|
||||
|
||||
static int guc_var_compare(const void *a, const void *b);
|
||||
static int guc_name_compare(const char *namea, const char *nameb);
|
||||
static void InitializeOneGUCOption(struct config_generic *gconf);
|
||||
static void InitializeOneGUCOption(struct config_generic * gconf);
|
||||
static void push_old_value(struct config_generic * gconf, GucAction action);
|
||||
static void ReportGUCOption(struct config_generic * record);
|
||||
static void ShowGUCConfigOption(const char *name, DestReceiver *dest);
|
||||
@ -2853,7 +2853,7 @@ set_stack_value(struct config_generic * gconf, union config_var_value * val)
|
||||
*((struct config_string *) gconf)->variable);
|
||||
break;
|
||||
case PGC_ENUM:
|
||||
val->enumval =
|
||||
val->enumval =
|
||||
*((struct config_enum *) gconf)->variable;
|
||||
break;
|
||||
}
|
||||
@ -3290,7 +3290,7 @@ InitializeGUCOptions(void)
|
||||
* Initialize one GUC option variable to its compiled-in default.
|
||||
*/
|
||||
static void
|
||||
InitializeOneGUCOption(struct config_generic *gconf)
|
||||
InitializeOneGUCOption(struct config_generic * gconf)
|
||||
{
|
||||
gconf->status = 0;
|
||||
gconf->reset_source = PGC_S_DEFAULT;
|
||||
@ -3302,100 +3302,100 @@ InitializeOneGUCOption(struct config_generic *gconf)
|
||||
switch (gconf->vartype)
|
||||
{
|
||||
case PGC_BOOL:
|
||||
{
|
||||
struct config_bool *conf = (struct config_bool *) gconf;
|
||||
|
||||
if (conf->assign_hook)
|
||||
if (!(*conf->assign_hook) (conf->boot_val, true,
|
||||
PGC_S_DEFAULT))
|
||||
elog(FATAL, "failed to initialize %s to %d",
|
||||
conf->gen.name, (int) conf->boot_val);
|
||||
*conf->variable = conf->reset_val = conf->boot_val;
|
||||
break;
|
||||
}
|
||||
case PGC_INT:
|
||||
{
|
||||
struct config_int *conf = (struct config_int *) gconf;
|
||||
|
||||
Assert(conf->boot_val >= conf->min);
|
||||
Assert(conf->boot_val <= conf->max);
|
||||
if (conf->assign_hook)
|
||||
if (!(*conf->assign_hook) (conf->boot_val, true,
|
||||
PGC_S_DEFAULT))
|
||||
elog(FATAL, "failed to initialize %s to %d",
|
||||
conf->gen.name, conf->boot_val);
|
||||
*conf->variable = conf->reset_val = conf->boot_val;
|
||||
break;
|
||||
}
|
||||
case PGC_REAL:
|
||||
{
|
||||
struct config_real *conf = (struct config_real *) gconf;
|
||||
|
||||
Assert(conf->boot_val >= conf->min);
|
||||
Assert(conf->boot_val <= conf->max);
|
||||
if (conf->assign_hook)
|
||||
if (!(*conf->assign_hook) (conf->boot_val, true,
|
||||
PGC_S_DEFAULT))
|
||||
elog(FATAL, "failed to initialize %s to %g",
|
||||
conf->gen.name, conf->boot_val);
|
||||
*conf->variable = conf->reset_val = conf->boot_val;
|
||||
break;
|
||||
}
|
||||
case PGC_STRING:
|
||||
{
|
||||
struct config_string *conf = (struct config_string *) gconf;
|
||||
char *str;
|
||||
|
||||
*conf->variable = NULL;
|
||||
conf->reset_val = NULL;
|
||||
|
||||
if (conf->boot_val == NULL)
|
||||
{
|
||||
/* leave the value NULL, do not call assign hook */
|
||||
struct config_bool *conf = (struct config_bool *) gconf;
|
||||
|
||||
if (conf->assign_hook)
|
||||
if (!(*conf->assign_hook) (conf->boot_val, true,
|
||||
PGC_S_DEFAULT))
|
||||
elog(FATAL, "failed to initialize %s to %d",
|
||||
conf->gen.name, (int) conf->boot_val);
|
||||
*conf->variable = conf->reset_val = conf->boot_val;
|
||||
break;
|
||||
}
|
||||
|
||||
str = guc_strdup(FATAL, conf->boot_val);
|
||||
conf->reset_val = str;
|
||||
|
||||
if (conf->assign_hook)
|
||||
case PGC_INT:
|
||||
{
|
||||
const char *newstr;
|
||||
struct config_int *conf = (struct config_int *) gconf;
|
||||
|
||||
newstr = (*conf->assign_hook) (str, true,
|
||||
PGC_S_DEFAULT);
|
||||
if (newstr == NULL)
|
||||
{
|
||||
elog(FATAL, "failed to initialize %s to \"%s\"",
|
||||
conf->gen.name, str);
|
||||
}
|
||||
else if (newstr != str)
|
||||
{
|
||||
free(str);
|
||||
|
||||
/*
|
||||
* See notes in set_config_option about casting
|
||||
*/
|
||||
str = (char *) newstr;
|
||||
conf->reset_val = str;
|
||||
}
|
||||
Assert(conf->boot_val >= conf->min);
|
||||
Assert(conf->boot_val <= conf->max);
|
||||
if (conf->assign_hook)
|
||||
if (!(*conf->assign_hook) (conf->boot_val, true,
|
||||
PGC_S_DEFAULT))
|
||||
elog(FATAL, "failed to initialize %s to %d",
|
||||
conf->gen.name, conf->boot_val);
|
||||
*conf->variable = conf->reset_val = conf->boot_val;
|
||||
break;
|
||||
}
|
||||
*conf->variable = str;
|
||||
break;
|
||||
}
|
||||
case PGC_ENUM:
|
||||
{
|
||||
struct config_enum *conf = (struct config_enum *) gconf;
|
||||
case PGC_REAL:
|
||||
{
|
||||
struct config_real *conf = (struct config_real *) gconf;
|
||||
|
||||
if (conf->assign_hook)
|
||||
if (!(*conf->assign_hook) (conf->boot_val, true,
|
||||
PGC_S_DEFAULT))
|
||||
elog(FATAL, "failed to initialize %s to %s",
|
||||
conf->gen.name,
|
||||
config_enum_lookup_by_value(conf, conf->boot_val));
|
||||
*conf->variable = conf->reset_val = conf->boot_val;
|
||||
break;
|
||||
}
|
||||
Assert(conf->boot_val >= conf->min);
|
||||
Assert(conf->boot_val <= conf->max);
|
||||
if (conf->assign_hook)
|
||||
if (!(*conf->assign_hook) (conf->boot_val, true,
|
||||
PGC_S_DEFAULT))
|
||||
elog(FATAL, "failed to initialize %s to %g",
|
||||
conf->gen.name, conf->boot_val);
|
||||
*conf->variable = conf->reset_val = conf->boot_val;
|
||||
break;
|
||||
}
|
||||
case PGC_STRING:
|
||||
{
|
||||
struct config_string *conf = (struct config_string *) gconf;
|
||||
char *str;
|
||||
|
||||
*conf->variable = NULL;
|
||||
conf->reset_val = NULL;
|
||||
|
||||
if (conf->boot_val == NULL)
|
||||
{
|
||||
/* leave the value NULL, do not call assign hook */
|
||||
break;
|
||||
}
|
||||
|
||||
str = guc_strdup(FATAL, conf->boot_val);
|
||||
conf->reset_val = str;
|
||||
|
||||
if (conf->assign_hook)
|
||||
{
|
||||
const char *newstr;
|
||||
|
||||
newstr = (*conf->assign_hook) (str, true,
|
||||
PGC_S_DEFAULT);
|
||||
if (newstr == NULL)
|
||||
{
|
||||
elog(FATAL, "failed to initialize %s to \"%s\"",
|
||||
conf->gen.name, str);
|
||||
}
|
||||
else if (newstr != str)
|
||||
{
|
||||
free(str);
|
||||
|
||||
/*
|
||||
* See notes in set_config_option about casting
|
||||
*/
|
||||
str = (char *) newstr;
|
||||
conf->reset_val = str;
|
||||
}
|
||||
}
|
||||
*conf->variable = str;
|
||||
break;
|
||||
}
|
||||
case PGC_ENUM:
|
||||
{
|
||||
struct config_enum *conf = (struct config_enum *) gconf;
|
||||
|
||||
if (conf->assign_hook)
|
||||
if (!(*conf->assign_hook) (conf->boot_val, true,
|
||||
PGC_S_DEFAULT))
|
||||
elog(FATAL, "failed to initialize %s to %s",
|
||||
conf->gen.name,
|
||||
config_enum_lookup_by_value(conf, conf->boot_val));
|
||||
*conf->variable = conf->reset_val = conf->boot_val;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4009,13 +4009,13 @@ AtEOXact_GUC(bool isCommit, int nestLevel)
|
||||
case PGC_ENUM:
|
||||
{
|
||||
struct config_enum *conf = (struct config_enum *) gconf;
|
||||
int newval = newvalue.enumval;
|
||||
int newval = newvalue.enumval;
|
||||
|
||||
if (*conf->variable != newval)
|
||||
{
|
||||
if (conf->assign_hook)
|
||||
if (!(*conf->assign_hook) (newval,
|
||||
true, PGC_S_OVERRIDE))
|
||||
true, PGC_S_OVERRIDE))
|
||||
elog(LOG, "failed to commit %s as %s",
|
||||
conf->gen.name,
|
||||
config_enum_lookup_by_value(conf, newval));
|
||||
@ -4351,7 +4351,7 @@ parse_real(const char *value, double *result)
|
||||
* allocated for modification.
|
||||
*/
|
||||
const char *
|
||||
config_enum_lookup_by_value(struct config_enum *record, int val)
|
||||
config_enum_lookup_by_value(struct config_enum * record, int val)
|
||||
{
|
||||
const struct config_enum_entry *entry;
|
||||
|
||||
@ -4363,7 +4363,7 @@ config_enum_lookup_by_value(struct config_enum *record, int val)
|
||||
|
||||
elog(ERROR, "could not find enum option %d for %s",
|
||||
val, record->gen.name);
|
||||
return NULL; /* silence compiler */
|
||||
return NULL; /* silence compiler */
|
||||
}
|
||||
|
||||
|
||||
@ -4374,7 +4374,7 @@ config_enum_lookup_by_value(struct config_enum *record, int val)
|
||||
* true. If it's not found, return FALSE and retval is set to 0.
|
||||
*/
|
||||
bool
|
||||
config_enum_lookup_by_name(struct config_enum *record, const char *value,
|
||||
config_enum_lookup_by_name(struct config_enum * record, const char *value,
|
||||
int *retval)
|
||||
{
|
||||
const struct config_enum_entry *entry;
|
||||
@ -4400,16 +4400,16 @@ config_enum_lookup_by_name(struct config_enum *record, const char *value,
|
||||
* If suffix is non-NULL, it is added to the end of the string.
|
||||
*/
|
||||
static char *
|
||||
config_enum_get_options(struct config_enum *record, const char *prefix,
|
||||
config_enum_get_options(struct config_enum * record, const char *prefix,
|
||||
const char *suffix, const char *separator)
|
||||
{
|
||||
const struct config_enum_entry *entry;
|
||||
StringInfoData retstr;
|
||||
StringInfoData retstr;
|
||||
int seplen;
|
||||
|
||||
initStringInfo(&retstr);
|
||||
appendStringInfoString(&retstr, prefix);
|
||||
|
||||
|
||||
seplen = strlen(separator);
|
||||
for (entry = record->options; entry && entry->name; entry++)
|
||||
{
|
||||
@ -4421,11 +4421,11 @@ config_enum_get_options(struct config_enum *record, const char *prefix,
|
||||
}
|
||||
|
||||
/*
|
||||
* All the entries may have been hidden, leaving the string empty
|
||||
* if no prefix was given. This indicates a broken GUC setup, since
|
||||
* there is no use for an enum without any values, so we just check
|
||||
* to make sure we don't write to invalid memory instead of actually
|
||||
* trying to do something smart with it.
|
||||
* All the entries may have been hidden, leaving the string empty if no
|
||||
* prefix was given. This indicates a broken GUC setup, since there is no
|
||||
* use for an enum without any values, so we just check to make sure we
|
||||
* don't write to invalid memory instead of actually trying to do
|
||||
* something smart with it.
|
||||
*/
|
||||
if (retstr.len >= seplen)
|
||||
{
|
||||
@ -4565,8 +4565,8 @@ set_config_option(const char *name, const char *value,
|
||||
if (changeVal && !is_newvalue_equal(record, value))
|
||||
ereport(elevel,
|
||||
(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
|
||||
errmsg("attempted change of parameter \"%s\" ignored",
|
||||
name),
|
||||
errmsg("attempted change of parameter \"%s\" ignored",
|
||||
name),
|
||||
errdetail("This parameter cannot be changed after server start.")));
|
||||
return true;
|
||||
}
|
||||
@ -4574,8 +4574,8 @@ set_config_option(const char *name, const char *value,
|
||||
{
|
||||
ereport(elevel,
|
||||
(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
|
||||
errmsg("attempted change of parameter \"%s\" ignored",
|
||||
name),
|
||||
errmsg("attempted change of parameter \"%s\" ignored",
|
||||
name),
|
||||
errdetail("This parameter cannot be changed after server start.")));
|
||||
return false;
|
||||
}
|
||||
@ -5004,16 +5004,16 @@ set_config_option(const char *name, const char *value,
|
||||
{
|
||||
if (!config_enum_lookup_by_name(conf, value, &newval))
|
||||
{
|
||||
char *hintmsg;
|
||||
|
||||
hintmsg = config_enum_get_options(conf,
|
||||
"Available values: ",
|
||||
char *hintmsg;
|
||||
|
||||
hintmsg = config_enum_get_options(conf,
|
||||
"Available values: ",
|
||||
".", ", ");
|
||||
|
||||
ereport(elevel,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("invalid value for parameter \"%s\": \"%s\"",
|
||||
name, value),
|
||||
errmsg("invalid value for parameter \"%s\": \"%s\"",
|
||||
name, value),
|
||||
hintmsg ? errhint("%s", _(hintmsg)) : 0));
|
||||
|
||||
if (hintmsg)
|
||||
@ -5038,9 +5038,9 @@ set_config_option(const char *name, const char *value,
|
||||
{
|
||||
ereport(elevel,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("invalid value for parameter \"%s\": \"%s\"",
|
||||
name,
|
||||
config_enum_lookup_by_value(conf, newval))));
|
||||
errmsg("invalid value for parameter \"%s\": \"%s\"",
|
||||
name,
|
||||
config_enum_lookup_by_value(conf, newval))));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -5088,8 +5088,8 @@ set_config_sourcefile(const char *name, char *sourcefile, int sourceline)
|
||||
int elevel;
|
||||
|
||||
/*
|
||||
* To avoid cluttering the log, only the postmaster bleats loudly
|
||||
* about problems with the config file.
|
||||
* To avoid cluttering the log, only the postmaster bleats loudly about
|
||||
* problems with the config file.
|
||||
*/
|
||||
elevel = IsUnderPostmaster ? DEBUG3 : LOG;
|
||||
|
||||
@ -5166,7 +5166,7 @@ GetConfigOption(const char *name)
|
||||
|
||||
case PGC_ENUM:
|
||||
return config_enum_lookup_by_value((struct config_enum *) record,
|
||||
*((struct config_enum *) record)->variable);
|
||||
*((struct config_enum *) record)->variable);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@ -5214,7 +5214,7 @@ GetConfigOptionResetString(const char *name)
|
||||
|
||||
case PGC_ENUM:
|
||||
return config_enum_lookup_by_value((struct config_enum *) record,
|
||||
((struct config_enum *) record)->reset_val);
|
||||
((struct config_enum *) record)->reset_val);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@ -5244,7 +5244,7 @@ IsSuperuserConfigOption(const char *name)
|
||||
* report (in addition to the generic "invalid value for option FOO" that
|
||||
* guc.c will provide). Note that the result might be ERROR or a lower
|
||||
* level, so the caller must be prepared for control to return from ereport,
|
||||
* or not. If control does return, return false/NULL from the hook function.
|
||||
* or not. If control does return, return false/NULL from the hook function.
|
||||
*
|
||||
* At some point it'd be nice to replace this with a mechanism that allows
|
||||
* the custom message to become the DETAIL line of guc.c's generic message.
|
||||
@ -5266,9 +5266,9 @@ GUC_complaint_elevel(GucSource source)
|
||||
{
|
||||
/*
|
||||
* If we're a postmaster child, this is probably "undo" during
|
||||
* transaction abort, so we don't want to clutter the log. There's
|
||||
* a small chance of a real problem with an OVERRIDE setting,
|
||||
* though, so suppressing the message entirely wouldn't be desirable.
|
||||
* transaction abort, so we don't want to clutter the log. There's a
|
||||
* small chance of a real problem with an OVERRIDE setting, though, so
|
||||
* suppressing the message entirely wouldn't be desirable.
|
||||
*/
|
||||
elevel = IsUnderPostmaster ? DEBUG5 : LOG;
|
||||
}
|
||||
@ -5324,22 +5324,22 @@ flatten_set_variable_args(const char *name, List *args)
|
||||
|
||||
/*
|
||||
* Each list member may be a plain A_Const node, or an A_Const within a
|
||||
* TypeCast; the latter case is supported only for ConstInterval
|
||||
* arguments (for SET TIME ZONE).
|
||||
* TypeCast; the latter case is supported only for ConstInterval arguments
|
||||
* (for SET TIME ZONE).
|
||||
*/
|
||||
foreach(l, args)
|
||||
{
|
||||
Node *arg = (Node *) lfirst(l);
|
||||
Node *arg = (Node *) lfirst(l);
|
||||
char *val;
|
||||
TypeName *typename = NULL;
|
||||
A_Const *con;
|
||||
A_Const *con;
|
||||
|
||||
if (l != list_head(args))
|
||||
appendStringInfo(&buf, ", ");
|
||||
|
||||
if (IsA(arg, TypeCast))
|
||||
{
|
||||
TypeCast *tc = (TypeCast *) arg;
|
||||
TypeCast *tc = (TypeCast *) arg;
|
||||
|
||||
arg = tc->arg;
|
||||
typename = tc->typename;
|
||||
@ -5597,11 +5597,11 @@ init_custom_variable(const char *name,
|
||||
struct config_generic *gen;
|
||||
|
||||
/*
|
||||
* Only allow custom PGC_POSTMASTER variables to be created during
|
||||
* shared library preload; any later than that, we can't ensure that
|
||||
* the value doesn't change after startup. This is a fatal elog if it
|
||||
* happens; just erroring out isn't safe because we don't know what
|
||||
* the calling loadable module might already have hooked into.
|
||||
* Only allow custom PGC_POSTMASTER variables to be created during shared
|
||||
* library preload; any later than that, we can't ensure that the value
|
||||
* doesn't change after startup. This is a fatal elog if it happens; just
|
||||
* erroring out isn't safe because we don't know what the calling loadable
|
||||
* module might already have hooked into.
|
||||
*/
|
||||
if (context == PGC_POSTMASTER &&
|
||||
!process_shared_preload_libraries_in_progress)
|
||||
@ -5632,7 +5632,7 @@ define_custom_variable(struct config_generic * variable)
|
||||
const char **nameAddr = &name;
|
||||
const char *value;
|
||||
struct config_string *pHolder;
|
||||
GucContext phcontext;
|
||||
GucContext phcontext;
|
||||
struct config_generic **res;
|
||||
|
||||
/*
|
||||
@ -5679,9 +5679,9 @@ define_custom_variable(struct config_generic * variable)
|
||||
*res = variable;
|
||||
|
||||
/*
|
||||
* Infer context for assignment based on source of existing value.
|
||||
* We can't tell this with exact accuracy, but we can at least do
|
||||
* something reasonable in typical cases.
|
||||
* Infer context for assignment based on source of existing value. We
|
||||
* can't tell this with exact accuracy, but we can at least do something
|
||||
* reasonable in typical cases.
|
||||
*/
|
||||
switch (pHolder->gen.source)
|
||||
{
|
||||
@ -5689,10 +5689,11 @@ define_custom_variable(struct config_generic * variable)
|
||||
case PGC_S_ENV_VAR:
|
||||
case PGC_S_FILE:
|
||||
case PGC_S_ARGV:
|
||||
|
||||
/*
|
||||
* If we got past the check in init_custom_variable, we can
|
||||
* safely assume that any existing value for a PGC_POSTMASTER
|
||||
* variable was set in postmaster context.
|
||||
* If we got past the check in init_custom_variable, we can safely
|
||||
* assume that any existing value for a PGC_POSTMASTER variable
|
||||
* was set in postmaster context.
|
||||
*/
|
||||
if (variable->context == PGC_POSTMASTER)
|
||||
phcontext = PGC_POSTMASTER;
|
||||
@ -5852,7 +5853,7 @@ DefineCustomEnumVariable(const char *name,
|
||||
const char *long_desc,
|
||||
int *valueAddr,
|
||||
int bootValue,
|
||||
const struct config_enum_entry *options,
|
||||
const struct config_enum_entry * options,
|
||||
GucContext context,
|
||||
int flags,
|
||||
GucEnumAssignHook assign_hook,
|
||||
@ -6165,13 +6166,13 @@ GetConfigOptionByNum(int varnum, const char **values, bool *noshow)
|
||||
/* enumvals */
|
||||
values[11] = NULL;
|
||||
|
||||
/* boot_val */
|
||||
snprintf(buffer, sizeof(buffer), "%d", lconf->boot_val);
|
||||
values[12] = pstrdup(buffer);
|
||||
/* boot_val */
|
||||
snprintf(buffer, sizeof(buffer), "%d", lconf->boot_val);
|
||||
values[12] = pstrdup(buffer);
|
||||
|
||||
/* reset_val */
|
||||
snprintf(buffer, sizeof(buffer), "%d", lconf->reset_val);
|
||||
values[13] = pstrdup(buffer);
|
||||
/* reset_val */
|
||||
snprintf(buffer, sizeof(buffer), "%d", lconf->reset_val);
|
||||
values[13] = pstrdup(buffer);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -6190,19 +6191,19 @@ GetConfigOptionByNum(int varnum, const char **values, bool *noshow)
|
||||
/* enumvals */
|
||||
values[11] = NULL;
|
||||
|
||||
/* boot_val */
|
||||
snprintf(buffer, sizeof(buffer), "%g", lconf->boot_val);
|
||||
values[12] = pstrdup(buffer);
|
||||
/* boot_val */
|
||||
snprintf(buffer, sizeof(buffer), "%g", lconf->boot_val);
|
||||
values[12] = pstrdup(buffer);
|
||||
|
||||
/* reset_val */
|
||||
snprintf(buffer, sizeof(buffer), "%g", lconf->reset_val);
|
||||
values[13] = pstrdup(buffer);
|
||||
/* reset_val */
|
||||
snprintf(buffer, sizeof(buffer), "%g", lconf->reset_val);
|
||||
values[13] = pstrdup(buffer);
|
||||
}
|
||||
break;
|
||||
|
||||
case PGC_STRING:
|
||||
{
|
||||
struct config_string *lconf = (struct config_string *) conf;
|
||||
struct config_string *lconf = (struct config_string *) conf;
|
||||
|
||||
/* min_val */
|
||||
values[9] = NULL;
|
||||
@ -6213,15 +6214,15 @@ GetConfigOptionByNum(int varnum, const char **values, bool *noshow)
|
||||
/* enumvals */
|
||||
values[11] = NULL;
|
||||
|
||||
/* boot_val */
|
||||
if (lconf->boot_val == NULL)
|
||||
values[12] = NULL;
|
||||
/* boot_val */
|
||||
if (lconf->boot_val == NULL)
|
||||
values[12] = NULL;
|
||||
else
|
||||
values[12] = pstrdup(lconf->boot_val);
|
||||
|
||||
/* reset_val */
|
||||
if (lconf->reset_val == NULL)
|
||||
values[13] = NULL;
|
||||
/* reset_val */
|
||||
if (lconf->reset_val == NULL)
|
||||
values[13] = NULL;
|
||||
else
|
||||
values[13] = pstrdup(lconf->reset_val);
|
||||
}
|
||||
@ -6229,7 +6230,7 @@ GetConfigOptionByNum(int varnum, const char **values, bool *noshow)
|
||||
|
||||
case PGC_ENUM:
|
||||
{
|
||||
struct config_enum *lconf = (struct config_enum *) conf;
|
||||
struct config_enum *lconf = (struct config_enum *) conf;
|
||||
|
||||
/* min_val */
|
||||
values[9] = NULL;
|
||||
@ -6238,17 +6239,21 @@ GetConfigOptionByNum(int varnum, const char **values, bool *noshow)
|
||||
values[10] = NULL;
|
||||
|
||||
/* enumvals */
|
||||
/* NOTE! enumvals with double quotes in them are not supported! */
|
||||
|
||||
/*
|
||||
* NOTE! enumvals with double quotes in them are not
|
||||
* supported!
|
||||
*/
|
||||
values[11] = config_enum_get_options((struct config_enum *) conf,
|
||||
"{\"", "\"}", "\",\"");
|
||||
|
||||
/* boot_val */
|
||||
/* boot_val */
|
||||
values[12] = pstrdup(config_enum_lookup_by_value(lconf,
|
||||
lconf->boot_val));
|
||||
lconf->boot_val));
|
||||
|
||||
/* reset_val */
|
||||
/* reset_val */
|
||||
values[13] = pstrdup(config_enum_lookup_by_value(lconf,
|
||||
lconf->reset_val));
|
||||
lconf->reset_val));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -6267,18 +6272,18 @@ GetConfigOptionByNum(int varnum, const char **values, bool *noshow)
|
||||
/* enumvals */
|
||||
values[11] = NULL;
|
||||
|
||||
/* boot_val */
|
||||
values[12] = NULL;
|
||||
/* boot_val */
|
||||
values[12] = NULL;
|
||||
|
||||
/* reset_val */
|
||||
values[13] = NULL;
|
||||
/* reset_val */
|
||||
values[13] = NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the setting came from a config file, set the source location.
|
||||
* For security reasons, we don't show source file/line number for
|
||||
/*
|
||||
* If the setting came from a config file, set the source location. For
|
||||
* security reasons, we don't show source file/line number for
|
||||
* non-superusers.
|
||||
*/
|
||||
if (conf->source == PGC_S_FILE && superuser())
|
||||
@ -6379,10 +6384,10 @@ show_all_settings(PG_FUNCTION_ARGS)
|
||||
TEXTOID, -1, 0);
|
||||
TupleDescInitEntry(tupdesc, (AttrNumber) 12, "enumvals",
|
||||
TEXTARRAYOID, -1, 0);
|
||||
TupleDescInitEntry(tupdesc, (AttrNumber) 13, "boot_val",
|
||||
TEXTOID, -1, 0);
|
||||
TupleDescInitEntry(tupdesc, (AttrNumber) 14, "reset_val",
|
||||
TEXTOID, -1, 0);
|
||||
TupleDescInitEntry(tupdesc, (AttrNumber) 13, "boot_val",
|
||||
TEXTOID, -1, 0);
|
||||
TupleDescInitEntry(tupdesc, (AttrNumber) 14, "reset_val",
|
||||
TEXTOID, -1, 0);
|
||||
TupleDescInitEntry(tupdesc, (AttrNumber) 15, "sourcefile",
|
||||
TEXTOID, -1, 0);
|
||||
TupleDescInitEntry(tupdesc, (AttrNumber) 16, "sourceline",
|
||||
@ -6476,10 +6481,10 @@ _ShowOption(struct config_generic * record, bool use_units)
|
||||
{
|
||||
/*
|
||||
* Use int64 arithmetic to avoid overflows in units
|
||||
* conversion. If INT64_IS_BUSTED we might overflow
|
||||
* conversion. If INT64_IS_BUSTED we might overflow
|
||||
* anyway and print bogus answers, but there are few
|
||||
* enough such machines that it doesn't seem worth
|
||||
* trying harder.
|
||||
* enough such machines that it doesn't seem worth trying
|
||||
* harder.
|
||||
*/
|
||||
int64 result = *conf->variable;
|
||||
const char *unit;
|
||||
@ -6592,7 +6597,7 @@ _ShowOption(struct config_generic * record, bool use_units)
|
||||
{
|
||||
struct config_enum *conf = (struct config_enum *) record;
|
||||
|
||||
if(conf->show_hook)
|
||||
if (conf->show_hook)
|
||||
val = (*conf->show_hook) ();
|
||||
else
|
||||
val = config_enum_lookup_by_value(conf, *conf->variable);
|
||||
@ -6681,7 +6686,7 @@ is_newvalue_equal(struct config_generic * record, const char *newvalue)
|
||||
* variable source, integer
|
||||
*/
|
||||
static void
|
||||
write_one_nondefault_variable(FILE *fp, struct config_generic *gconf)
|
||||
write_one_nondefault_variable(FILE *fp, struct config_generic * gconf)
|
||||
{
|
||||
if (gconf->source == PGC_S_DEFAULT)
|
||||
return;
|
||||
@ -6692,49 +6697,49 @@ write_one_nondefault_variable(FILE *fp, struct config_generic *gconf)
|
||||
switch (gconf->vartype)
|
||||
{
|
||||
case PGC_BOOL:
|
||||
{
|
||||
struct config_bool *conf = (struct config_bool *) gconf;
|
||||
{
|
||||
struct config_bool *conf = (struct config_bool *) gconf;
|
||||
|
||||
if (*conf->variable)
|
||||
fprintf(fp, "true");
|
||||
else
|
||||
fprintf(fp, "false");
|
||||
}
|
||||
break;
|
||||
if (*conf->variable)
|
||||
fprintf(fp, "true");
|
||||
else
|
||||
fprintf(fp, "false");
|
||||
}
|
||||
break;
|
||||
|
||||
case PGC_INT:
|
||||
{
|
||||
struct config_int *conf = (struct config_int *) gconf;
|
||||
{
|
||||
struct config_int *conf = (struct config_int *) gconf;
|
||||
|
||||
fprintf(fp, "%d", *conf->variable);
|
||||
}
|
||||
break;
|
||||
fprintf(fp, "%d", *conf->variable);
|
||||
}
|
||||
break;
|
||||
|
||||
case PGC_REAL:
|
||||
{
|
||||
struct config_real *conf = (struct config_real *) gconf;
|
||||
{
|
||||
struct config_real *conf = (struct config_real *) gconf;
|
||||
|
||||
/* Could lose precision here? */
|
||||
fprintf(fp, "%f", *conf->variable);
|
||||
}
|
||||
break;
|
||||
/* Could lose precision here? */
|
||||
fprintf(fp, "%f", *conf->variable);
|
||||
}
|
||||
break;
|
||||
|
||||
case PGC_STRING:
|
||||
{
|
||||
struct config_string *conf = (struct config_string *) gconf;
|
||||
{
|
||||
struct config_string *conf = (struct config_string *) gconf;
|
||||
|
||||
fprintf(fp, "%s", *conf->variable);
|
||||
}
|
||||
break;
|
||||
fprintf(fp, "%s", *conf->variable);
|
||||
}
|
||||
break;
|
||||
|
||||
case PGC_ENUM:
|
||||
{
|
||||
struct config_enum *conf = (struct config_enum *) gconf;
|
||||
|
||||
fprintf(fp, "%s",
|
||||
config_enum_lookup_by_value(conf, *conf->variable));
|
||||
}
|
||||
break;
|
||||
{
|
||||
struct config_enum *conf = (struct config_enum *) gconf;
|
||||
|
||||
fprintf(fp, "%s",
|
||||
config_enum_lookup_by_value(conf, *conf->variable));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
fputc(0, fp);
|
||||
@ -7157,7 +7162,7 @@ assign_log_destination(const char *value, bool doit, GucSource source)
|
||||
list_free(elemlist);
|
||||
ereport(GUC_complaint_elevel(source),
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("invalid list syntax for parameter \"log_destination\"")));
|
||||
errmsg("invalid list syntax for parameter \"log_destination\"")));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -7573,11 +7578,11 @@ assign_effective_io_concurrency(int newval, bool doit, GucSource source)
|
||||
*
|
||||
* drives | I/O requests
|
||||
* -------+----------------
|
||||
* 1 | 1
|
||||
* 2 | 2/1 + 2/2 = 3
|
||||
* 3 | 3/1 + 3/2 + 3/3 = 5 1/2
|
||||
* 4 | 4/1 + 4/2 + 4/3 + 4/4 = 8 1/3
|
||||
* n | n * H(n)
|
||||
* 1 | 1
|
||||
* 2 | 2/1 + 2/2 = 3
|
||||
* 3 | 3/1 + 3/2 + 3/3 = 5 1/2
|
||||
* 4 | 4/1 + 4/2 + 4/3 + 4/4 = 8 1/3
|
||||
* n | n * H(n)
|
||||
*
|
||||
* This is called the "coupon collector problem" and H(n) is called the
|
||||
* harmonic series. This could be approximated by n * ln(n), but for
|
||||
@ -7610,7 +7615,7 @@ assign_effective_io_concurrency(int newval, bool doit, GucSource source)
|
||||
return false;
|
||||
#else
|
||||
return true;
|
||||
#endif /* USE_PREFETCH */
|
||||
#endif /* USE_PREFETCH */
|
||||
}
|
||||
|
||||
static const char *
|
||||
@ -7624,9 +7629,9 @@ assign_pgstat_temp_directory(const char *newval, bool doit, GucSource source)
|
||||
|
||||
canonicalize_path(canon_val);
|
||||
|
||||
tname = guc_malloc(ERROR, strlen(canon_val) + 12); /* /pgstat.tmp */
|
||||
tname = guc_malloc(ERROR, strlen(canon_val) + 12); /* /pgstat.tmp */
|
||||
sprintf(tname, "%s/pgstat.tmp", canon_val);
|
||||
fname = guc_malloc(ERROR, strlen(canon_val) + 13); /* /pgstat.stat */
|
||||
fname = guc_malloc(ERROR, strlen(canon_val) + 13); /* /pgstat.stat */
|
||||
sprintf(fname, "%s/pgstat.stat", canon_val);
|
||||
|
||||
if (pgstat_stat_tmpname)
|
||||
|
Reference in New Issue
Block a user