Add all possible config file options.
This commit is contained in:
parent
3347fbad79
commit
7df3bb50f0
|
@ -4,7 +4,7 @@
|
||||||
* Support for grand unified configuration scheme, including SET
|
* Support for grand unified configuration scheme, including SET
|
||||||
* command, configuration file, and command line options.
|
* command, configuration file, and command line options.
|
||||||
*
|
*
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.27 2001/01/09 06:24:33 vadim Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.28 2001/01/24 18:37:31 momjian Exp $
|
||||||
*
|
*
|
||||||
* Copyright 2000 by PostgreSQL Global Development Group
|
* Copyright 2000 by PostgreSQL Global Development Group
|
||||||
* Written by Peter Eisentraut <peter_e@gmx.net>.
|
* Written by Peter Eisentraut <peter_e@gmx.net>.
|
||||||
|
@ -76,50 +76,50 @@ bool SQL_inheritance = true;
|
||||||
|
|
||||||
enum config_type
|
enum config_type
|
||||||
{
|
{
|
||||||
PGC_NONE = 0,
|
PGC_NONE = 0,
|
||||||
PGC_BOOL,
|
PGC_BOOL,
|
||||||
PGC_INT,
|
PGC_INT,
|
||||||
PGC_REAL,
|
PGC_REAL,
|
||||||
PGC_STRING
|
PGC_STRING
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct config_generic
|
struct config_generic
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
GucContext context;
|
GucContext context;
|
||||||
void *variable;
|
void *variable;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct config_bool
|
struct config_bool
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
GucContext context;
|
GucContext context;
|
||||||
bool *variable;
|
bool *variable;
|
||||||
bool default_val;
|
bool default_val;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct config_int
|
struct config_int
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
GucContext context;
|
GucContext context;
|
||||||
int *variable;
|
int *variable;
|
||||||
int default_val;
|
int default_val;
|
||||||
int min;
|
int min;
|
||||||
int max;
|
int max;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct config_real
|
struct config_real
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
GucContext context;
|
GucContext context;
|
||||||
double *variable;
|
double *variable;
|
||||||
double default_val;
|
double default_val;
|
||||||
double min;
|
double min;
|
||||||
double max;
|
double max;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -130,11 +130,11 @@ struct config_real
|
||||||
*/
|
*/
|
||||||
struct config_string
|
struct config_string
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
GucContext context;
|
GucContext context;
|
||||||
char **variable;
|
char **variable;
|
||||||
const char *default_val;
|
const char *default_val;
|
||||||
bool (*parse_hook)(const char *);
|
bool (*parse_hook)(const char *);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -152,7 +152,12 @@ struct config_string
|
||||||
*
|
*
|
||||||
* 4. Add a record below.
|
* 4. Add a record below.
|
||||||
*
|
*
|
||||||
* 5. Don't forget to document that option.
|
* 5. Add it to postgresql.conf.sample
|
||||||
|
*
|
||||||
|
* 6. Don't forget to document that option.
|
||||||
|
*
|
||||||
|
* WHEN MAKING MODIFICATIONS, remember to update postgresql.conf.sample
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -284,28 +289,28 @@ ConfigureNamesInt[] =
|
||||||
{"commit_delay", PGC_USERSET, &CommitDelay,
|
{"commit_delay", PGC_USERSET, &CommitDelay,
|
||||||
5, 0, 1000},
|
5, 0, 1000},
|
||||||
|
|
||||||
{NULL, 0, NULL, 0, 0, 0}
|
{NULL, 0, NULL, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static struct config_real
|
static struct config_real
|
||||||
ConfigureNamesReal[] =
|
ConfigureNamesReal[] =
|
||||||
{
|
{
|
||||||
{"effective_cache_size", PGC_USERSET, &effective_cache_size,
|
{"effective_cache_size", PGC_USERSET, &effective_cache_size,
|
||||||
DEFAULT_EFFECTIVE_CACHE_SIZE, 0, DBL_MAX},
|
DEFAULT_EFFECTIVE_CACHE_SIZE, 0, DBL_MAX},
|
||||||
{"random_page_cost", PGC_USERSET, &random_page_cost,
|
{"random_page_cost", PGC_USERSET, &random_page_cost,
|
||||||
DEFAULT_RANDOM_PAGE_COST, 0, DBL_MAX},
|
DEFAULT_RANDOM_PAGE_COST, 0, DBL_MAX},
|
||||||
{"cpu_tuple_cost", PGC_USERSET, &cpu_tuple_cost,
|
{"cpu_tuple_cost", PGC_USERSET, &cpu_tuple_cost,
|
||||||
DEFAULT_CPU_TUPLE_COST, 0, DBL_MAX},
|
DEFAULT_CPU_TUPLE_COST, 0, DBL_MAX},
|
||||||
{"cpu_index_tuple_cost", PGC_USERSET, &cpu_index_tuple_cost,
|
{"cpu_index_tuple_cost", PGC_USERSET, &cpu_index_tuple_cost,
|
||||||
DEFAULT_CPU_INDEX_TUPLE_COST, 0, DBL_MAX},
|
DEFAULT_CPU_INDEX_TUPLE_COST, 0, DBL_MAX},
|
||||||
{"cpu_operator_cost", PGC_USERSET, &cpu_operator_cost,
|
{"cpu_operator_cost", PGC_USERSET, &cpu_operator_cost,
|
||||||
DEFAULT_CPU_OPERATOR_COST, 0, DBL_MAX},
|
DEFAULT_CPU_OPERATOR_COST, 0, DBL_MAX},
|
||||||
|
|
||||||
{"geqo_selection_bias", PGC_USERSET, &Geqo_selection_bias,
|
{"geqo_selection_bias", PGC_USERSET, &Geqo_selection_bias,
|
||||||
DEFAULT_GEQO_SELECTION_BIAS, MIN_GEQO_SELECTION_BIAS, MAX_GEQO_SELECTION_BIAS},
|
DEFAULT_GEQO_SELECTION_BIAS, MIN_GEQO_SELECTION_BIAS, MAX_GEQO_SELECTION_BIAS},
|
||||||
|
|
||||||
{NULL, 0, NULL, 0.0, 0.0, 0.0}
|
{NULL, 0, NULL, 0.0, 0.0, 0.0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -319,10 +324,10 @@ ConfigureNamesString[] =
|
||||||
"", NULL},
|
"", NULL},
|
||||||
|
|
||||||
#ifdef ENABLE_SYSLOG
|
#ifdef ENABLE_SYSLOG
|
||||||
{"syslog_facility", PGC_POSTMASTER, &Syslog_facility,
|
{"syslog_facility", PGC_POSTMASTER, &Syslog_facility,
|
||||||
"LOCAL0", check_facility},
|
"LOCAL0", check_facility},
|
||||||
{"syslog_ident", PGC_POSTMASTER, &Syslog_ident,
|
{"syslog_ident", PGC_POSTMASTER, &Syslog_ident,
|
||||||
"postgres", NULL},
|
"postgres", NULL},
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{"unix_socket_directory", PGC_POSTMASTER, &UnixSocketDir,
|
{"unix_socket_directory", PGC_POSTMASTER, &UnixSocketDir,
|
||||||
|
@ -346,43 +351,43 @@ ConfigureNamesString[] =
|
||||||
static enum config_type
|
static enum config_type
|
||||||
find_option(const char * name, struct config_generic ** record)
|
find_option(const char * name, struct config_generic ** record)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
Assert(name);
|
Assert(name);
|
||||||
|
|
||||||
for (i = 0; ConfigureNamesBool[i].name; i++)
|
for (i = 0; ConfigureNamesBool[i].name; i++)
|
||||||
if (strcasecmp(ConfigureNamesBool[i].name, name)==0)
|
if (strcasecmp(ConfigureNamesBool[i].name, name)==0)
|
||||||
{
|
{
|
||||||
if (record)
|
if (record)
|
||||||
*record = (struct config_generic *)&ConfigureNamesBool[i];
|
*record = (struct config_generic *)&ConfigureNamesBool[i];
|
||||||
return PGC_BOOL;
|
return PGC_BOOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; ConfigureNamesInt[i].name; i++)
|
for (i = 0; ConfigureNamesInt[i].name; i++)
|
||||||
if (strcasecmp(ConfigureNamesInt[i].name, name)==0)
|
if (strcasecmp(ConfigureNamesInt[i].name, name)==0)
|
||||||
{
|
{
|
||||||
if (record)
|
if (record)
|
||||||
*record = (struct config_generic *)&ConfigureNamesInt[i];
|
*record = (struct config_generic *)&ConfigureNamesInt[i];
|
||||||
return PGC_INT;
|
return PGC_INT;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; ConfigureNamesReal[i].name; i++)
|
for (i = 0; ConfigureNamesReal[i].name; i++)
|
||||||
if (strcasecmp(ConfigureNamesReal[i].name, name)==0)
|
if (strcasecmp(ConfigureNamesReal[i].name, name)==0)
|
||||||
{
|
{
|
||||||
if (record)
|
if (record)
|
||||||
*record = (struct config_generic *)&ConfigureNamesReal[i];
|
*record = (struct config_generic *)&ConfigureNamesReal[i];
|
||||||
return PGC_REAL;
|
return PGC_REAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; ConfigureNamesString[i].name; i++)
|
for (i = 0; ConfigureNamesString[i].name; i++)
|
||||||
if (strcasecmp(ConfigureNamesString[i].name, name)==0)
|
if (strcasecmp(ConfigureNamesString[i].name, name)==0)
|
||||||
{
|
{
|
||||||
if (record)
|
if (record)
|
||||||
*record = (struct config_generic *)&ConfigureNamesString[i];
|
*record = (struct config_generic *)&ConfigureNamesString[i];
|
||||||
return PGC_STRING;
|
return PGC_STRING;
|
||||||
}
|
}
|
||||||
|
|
||||||
return PGC_NONE;
|
return PGC_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -394,16 +399,16 @@ find_option(const char * name, struct config_generic ** record)
|
||||||
void
|
void
|
||||||
ResetAllOptions(void)
|
ResetAllOptions(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; ConfigureNamesBool[i].name; i++)
|
for (i = 0; ConfigureNamesBool[i].name; i++)
|
||||||
*(ConfigureNamesBool[i].variable) = ConfigureNamesBool[i].default_val;
|
*(ConfigureNamesBool[i].variable) = ConfigureNamesBool[i].default_val;
|
||||||
|
|
||||||
for (i = 0; ConfigureNamesInt[i].name; i++)
|
for (i = 0; ConfigureNamesInt[i].name; i++)
|
||||||
*(ConfigureNamesInt[i].variable) = ConfigureNamesInt[i].default_val;
|
*(ConfigureNamesInt[i].variable) = ConfigureNamesInt[i].default_val;
|
||||||
|
|
||||||
for (i = 0; ConfigureNamesReal[i].name; i++)
|
for (i = 0; ConfigureNamesReal[i].name; i++)
|
||||||
*(ConfigureNamesReal[i].variable) = ConfigureNamesReal[i].default_val;
|
*(ConfigureNamesReal[i].variable) = ConfigureNamesReal[i].default_val;
|
||||||
|
|
||||||
for (i = 0; ConfigureNamesString[i].name; i++)
|
for (i = 0; ConfigureNamesString[i].name; i++)
|
||||||
{
|
{
|
||||||
|
@ -433,55 +438,55 @@ ResetAllOptions(void)
|
||||||
static bool
|
static bool
|
||||||
parse_bool(const char * value, bool * result)
|
parse_bool(const char * value, bool * result)
|
||||||
{
|
{
|
||||||
size_t len = strlen(value);
|
size_t len = strlen(value);
|
||||||
|
|
||||||
if (strncasecmp(value, "true", len)==0)
|
if (strncasecmp(value, "true", len)==0)
|
||||||
{
|
{
|
||||||
if (result)
|
if (result)
|
||||||
*result = true;
|
*result = true;
|
||||||
}
|
}
|
||||||
else if (strncasecmp(value, "false", len)==0)
|
else if (strncasecmp(value, "false", len)==0)
|
||||||
{
|
{
|
||||||
if (result)
|
if (result)
|
||||||
*result = false;
|
*result = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (strncasecmp(value, "yes", len)==0)
|
else if (strncasecmp(value, "yes", len)==0)
|
||||||
{
|
{
|
||||||
if (result)
|
if (result)
|
||||||
*result = true;
|
*result = true;
|
||||||
}
|
}
|
||||||
else if (strncasecmp(value, "no", len)==0)
|
else if (strncasecmp(value, "no", len)==0)
|
||||||
{
|
{
|
||||||
if (result)
|
if (result)
|
||||||
*result = false;
|
*result = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (strcasecmp(value, "on")==0)
|
else if (strcasecmp(value, "on")==0)
|
||||||
{
|
{
|
||||||
if (result)
|
if (result)
|
||||||
*result = true;
|
*result = true;
|
||||||
}
|
}
|
||||||
else if (strcasecmp(value, "off")==0)
|
else if (strcasecmp(value, "off")==0)
|
||||||
{
|
{
|
||||||
if (result)
|
if (result)
|
||||||
*result = false;
|
*result = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (strcasecmp(value, "1")==0)
|
else if (strcasecmp(value, "1")==0)
|
||||||
{
|
{
|
||||||
if (result)
|
if (result)
|
||||||
*result = true;
|
*result = true;
|
||||||
}
|
}
|
||||||
else if (strcasecmp(value, "0")==0)
|
else if (strcasecmp(value, "0")==0)
|
||||||
{
|
{
|
||||||
if (result)
|
if (result)
|
||||||
*result = false;
|
*result = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -495,16 +500,16 @@ parse_bool(const char * value, bool * result)
|
||||||
static bool
|
static bool
|
||||||
parse_int(const char * value, int * result)
|
parse_int(const char * value, int * result)
|
||||||
{
|
{
|
||||||
long val;
|
long val;
|
||||||
char * endptr;
|
char * endptr;
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
val = strtol(value, &endptr, 0);
|
val = strtol(value, &endptr, 0);
|
||||||
if (endptr == value || *endptr != '\0' || errno == ERANGE)
|
if (endptr == value || *endptr != '\0' || errno == ERANGE)
|
||||||
return false;
|
return false;
|
||||||
if (result)
|
if (result)
|
||||||
*result = (int)val;
|
*result = (int)val;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -517,16 +522,16 @@ parse_int(const char * value, int * result)
|
||||||
static bool
|
static bool
|
||||||
parse_real(const char * value, double * result)
|
parse_real(const char * value, double * result)
|
||||||
{
|
{
|
||||||
double val;
|
double val;
|
||||||
char * endptr;
|
char * endptr;
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
val = strtod(value, &endptr);
|
val = strtod(value, &endptr);
|
||||||
if (endptr == value || *endptr != '\0' || errno == ERANGE)
|
if (endptr == value || *endptr != '\0' || errno == ERANGE)
|
||||||
return false;
|
return false;
|
||||||
if (result)
|
if (result)
|
||||||
*result = val;
|
*result = val;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -555,14 +560,14 @@ bool
|
||||||
set_config_option(const char * name, const char * value, GucContext
|
set_config_option(const char * name, const char * value, GucContext
|
||||||
context, bool DoIt)
|
context, bool DoIt)
|
||||||
{
|
{
|
||||||
struct config_generic * record;
|
struct config_generic * record;
|
||||||
enum config_type type;
|
enum config_type type;
|
||||||
int elevel;
|
int elevel;
|
||||||
|
|
||||||
elevel = (context == PGC_SIGHUP) ? DEBUG : ERROR;
|
elevel = (context == PGC_SIGHUP) ? DEBUG : ERROR;
|
||||||
|
|
||||||
type = find_option(name, &record);
|
type = find_option(name, &record);
|
||||||
if (type == PGC_NONE)
|
if (type == PGC_NONE)
|
||||||
{
|
{
|
||||||
elog(elevel, "'%s' is not a valid option name", name);
|
elog(elevel, "'%s' is not a valid option name", name);
|
||||||
return false;
|
return false;
|
||||||
|
@ -573,7 +578,7 @@ set_config_option(const char * name, const char * value, GucContext
|
||||||
* precise rules. Note that we don't want to throw errors if we're
|
* precise rules. Note that we don't want to throw errors if we're
|
||||||
* in the SIGHUP context. In that case we just ignore the attempt.
|
* in the SIGHUP context. In that case we just ignore the attempt.
|
||||||
*/
|
*/
|
||||||
if (record->context == PGC_POSTMASTER && context != PGC_POSTMASTER)
|
if (record->context == PGC_POSTMASTER && context != PGC_POSTMASTER)
|
||||||
{
|
{
|
||||||
if (context != PGC_SIGHUP)
|
if (context != PGC_SIGHUP)
|
||||||
elog(ERROR, "'%s' cannot be changed after server start", name);
|
elog(ERROR, "'%s' cannot be changed after server start", name);
|
||||||
|
@ -607,83 +612,83 @@ set_config_option(const char * name, const char * value, GucContext
|
||||||
/*
|
/*
|
||||||
* Evaluate value and set variable
|
* Evaluate value and set variable
|
||||||
*/
|
*/
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
case PGC_BOOL:
|
case PGC_BOOL:
|
||||||
{
|
{
|
||||||
struct config_bool * conf = (struct config_bool *)record;
|
struct config_bool * conf = (struct config_bool *)record;
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
bool boolval;
|
bool boolval;
|
||||||
if (!parse_bool(value, &boolval))
|
if (!parse_bool(value, &boolval))
|
||||||
{
|
{
|
||||||
elog(elevel, "option '%s' requires a boolean value", name);
|
elog(elevel, "option '%s' requires a boolean value", name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (DoIt)
|
if (DoIt)
|
||||||
*conf->variable = boolval;
|
*conf->variable = boolval;
|
||||||
}
|
}
|
||||||
else if (DoIt)
|
else if (DoIt)
|
||||||
*conf->variable = conf->default_val;
|
*conf->variable = conf->default_val;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PGC_INT:
|
case PGC_INT:
|
||||||
{
|
{
|
||||||
struct config_int * conf = (struct config_int *)record;
|
struct config_int * conf = (struct config_int *)record;
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
int intval;
|
int intval;
|
||||||
|
|
||||||
if (!parse_int(value, &intval))
|
if (!parse_int(value, &intval))
|
||||||
{
|
{
|
||||||
elog(elevel, "option '%s' expects an integer value", name);
|
elog(elevel, "option '%s' expects an integer value", name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (intval < conf->min || intval > conf->max)
|
if (intval < conf->min || intval > conf->max)
|
||||||
{
|
{
|
||||||
elog(elevel, "option '%s' value %d is outside"
|
elog(elevel, "option '%s' value %d is outside"
|
||||||
" of permissible range [%d .. %d]",
|
" of permissible range [%d .. %d]",
|
||||||
name, intval, conf->min, conf->max);
|
name, intval, conf->min, conf->max);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (DoIt)
|
if (DoIt)
|
||||||
*conf->variable = intval;
|
*conf->variable = intval;
|
||||||
}
|
}
|
||||||
else if (DoIt)
|
else if (DoIt)
|
||||||
*conf->variable = conf->default_val;
|
*conf->variable = conf->default_val;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PGC_REAL:
|
case PGC_REAL:
|
||||||
{
|
{
|
||||||
struct config_real * conf = (struct config_real *)record;
|
struct config_real * conf = (struct config_real *)record;
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
double dval;
|
double dval;
|
||||||
|
|
||||||
if (!parse_real(value, &dval))
|
if (!parse_real(value, &dval))
|
||||||
{
|
{
|
||||||
elog(elevel, "option '%s' expects a real number", name);
|
elog(elevel, "option '%s' expects a real number", name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (dval < conf->min || dval > conf->max)
|
if (dval < conf->min || dval > conf->max)
|
||||||
{
|
{
|
||||||
elog(elevel, "option '%s' value %g is outside"
|
elog(elevel, "option '%s' value %g is outside"
|
||||||
" of permissible range [%g .. %g]",
|
" of permissible range [%g .. %g]",
|
||||||
name, dval, conf->min, conf->max);
|
name, dval, conf->min, conf->max);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (DoIt)
|
if (DoIt)
|
||||||
*conf->variable = dval;
|
*conf->variable = dval;
|
||||||
}
|
}
|
||||||
else if (DoIt)
|
else if (DoIt)
|
||||||
*conf->variable = conf->default_val;
|
*conf->variable = conf->default_val;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PGC_STRING:
|
case PGC_STRING:
|
||||||
{
|
{
|
||||||
|
@ -727,7 +732,7 @@ set_config_option(const char * name, const char * value, GucContext
|
||||||
}
|
}
|
||||||
|
|
||||||
default: ;
|
default: ;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -759,35 +764,35 @@ SetConfigOption(const char * name, const char * value, GucContext
|
||||||
const char *
|
const char *
|
||||||
GetConfigOption(const char * name)
|
GetConfigOption(const char * name)
|
||||||
{
|
{
|
||||||
struct config_generic * record;
|
struct config_generic * record;
|
||||||
static char buffer[256];
|
static char buffer[256];
|
||||||
enum config_type opttype;
|
enum config_type opttype;
|
||||||
|
|
||||||
opttype = find_option(name, &record);
|
opttype = find_option(name, &record);
|
||||||
if (opttype == PGC_NONE)
|
if (opttype == PGC_NONE)
|
||||||
elog(ERROR, "Option '%s' is not recognized", name);
|
elog(ERROR, "Option '%s' is not recognized", name);
|
||||||
|
|
||||||
switch(opttype)
|
switch(opttype)
|
||||||
{
|
{
|
||||||
case PGC_BOOL:
|
case PGC_BOOL:
|
||||||
return *((struct config_bool *)record)->variable ? "on" : "off";
|
return *((struct config_bool *)record)->variable ? "on" : "off";
|
||||||
|
|
||||||
case PGC_INT:
|
case PGC_INT:
|
||||||
snprintf(buffer, 256, "%d", *((struct config_int *)record)->variable);
|
snprintf(buffer, 256, "%d", *((struct config_int *)record)->variable);
|
||||||
return buffer;
|
return buffer;
|
||||||
|
|
||||||
case PGC_REAL:
|
case PGC_REAL:
|
||||||
snprintf(buffer, 256, "%g", *((struct config_real *)record)->variable);
|
snprintf(buffer, 256, "%g", *((struct config_real *)record)->variable);
|
||||||
return buffer;
|
return buffer;
|
||||||
|
|
||||||
case PGC_STRING:
|
case PGC_STRING:
|
||||||
return *((struct config_string *)record)->variable;
|
return *((struct config_string *)record)->variable;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -838,7 +843,7 @@ ParseLongOption(const char * string, char ** name, char ** value)
|
||||||
|
|
||||||
|
|
||||||
#ifdef ENABLE_SYSLOG
|
#ifdef ENABLE_SYSLOG
|
||||||
bool
|
bool
|
||||||
check_facility(const char *facility)
|
check_facility(const char *facility)
|
||||||
{
|
{
|
||||||
if (strcasecmp(facility,"LOCAL0") == 0) return true;
|
if (strcasecmp(facility,"LOCAL0") == 0) return true;
|
||||||
|
|
|
@ -18,3 +18,153 @@
|
||||||
# Any option can also be given as a command line switch to the
|
# Any option can also be given as a command line switch to the
|
||||||
# postmaster, e.g., 'postmaster -c log_connections=on'. Some options
|
# postmaster, e.g., 'postmaster -c log_connections=on'. Some options
|
||||||
# can be set at run-time with the 'SET' SQL command.
|
# can be set at run-time with the 'SET' SQL command.
|
||||||
|
|
||||||
|
|
||||||
|
#========================================================================
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Connection Parameters
|
||||||
|
#
|
||||||
|
#tcpip_socket = false
|
||||||
|
#ssl = false
|
||||||
|
|
||||||
|
#max_connections = 32 # 1-1024
|
||||||
|
|
||||||
|
#port = 5432
|
||||||
|
#hostname_lookup = false
|
||||||
|
#show_source_port = false
|
||||||
|
|
||||||
|
#unix_socket_directory = ""
|
||||||
|
#unix_socket_group = ""
|
||||||
|
#unix_socket_permissions = 0777
|
||||||
|
|
||||||
|
#virtual_host = ""
|
||||||
|
|
||||||
|
#krb_server_keyfile = ""
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Performance
|
||||||
|
#
|
||||||
|
#sort_mem = 512
|
||||||
|
#shared_buffers = 2*max_connections # min 16
|
||||||
|
#fsync = true
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Optimizer Parameters
|
||||||
|
#
|
||||||
|
#enable_seqscan = true
|
||||||
|
#enable_indexscan = true
|
||||||
|
#enable_tidscan = true
|
||||||
|
#enable_sort = true
|
||||||
|
#enable_nestloop = true
|
||||||
|
#enable_mergejoin = true
|
||||||
|
#enable_hashjoin = true
|
||||||
|
|
||||||
|
#ksqo = false
|
||||||
|
#geqo = true
|
||||||
|
|
||||||
|
#effective_cache_size = 1000 # default in 8k pages
|
||||||
|
#random_page_cost = 4
|
||||||
|
#cpu_tuple_cost = 0.01
|
||||||
|
#cpu_index_tuple_cost = 0.001
|
||||||
|
#cpu_operator_cost = 0.0025
|
||||||
|
#geqo_selection_bias = 2.0 # range 1.5-2.0
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# GEQO Optimizer Parameters
|
||||||
|
#
|
||||||
|
#geqo_threshold = 11
|
||||||
|
#geqo_pool_size = 0 #default based in tables, range 128-1024
|
||||||
|
#geqo_effort = 1
|
||||||
|
#geqo_generations = 0
|
||||||
|
#geqo_random_seed = -1 # auto-compute seed
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Inheritance
|
||||||
|
#
|
||||||
|
#sql_inheritance = true
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Deadlock
|
||||||
|
#
|
||||||
|
#deadlock_timeout = 1000
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Expression Depth Limitation
|
||||||
|
#
|
||||||
|
#max_expr_depth = 10000 # min 10
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Write-ahead log (WAL)
|
||||||
|
#
|
||||||
|
#wal_buffers = 8 # min 4
|
||||||
|
#wal_files = 0 # range 0-64
|
||||||
|
#wal_debug = 0 # range 0-16
|
||||||
|
#commit_delay = 5 # range 0-1000
|
||||||
|
#checkpoint_timeout = 300 # range 30-1800
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Debug display
|
||||||
|
#
|
||||||
|
#silent_mode = false
|
||||||
|
|
||||||
|
#log_connections = false
|
||||||
|
#log_timestamp = false
|
||||||
|
#log_pid = false
|
||||||
|
|
||||||
|
#debug_level = 0 # range 0-16
|
||||||
|
|
||||||
|
#debug_print_query = false
|
||||||
|
#debug_print_parse = false
|
||||||
|
#debug_print_rewritten = false
|
||||||
|
#debug_print_plan = false
|
||||||
|
#debug_pretty_print = false
|
||||||
|
|
||||||
|
#ifdef USE_ASSERT_CHECKING
|
||||||
|
#debug_assertions = true
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Syslog
|
||||||
|
#
|
||||||
|
#ifdef ENABLE_SYSLOG
|
||||||
|
#syslog = 0 # range 0-2
|
||||||
|
#syslog_facility = "LOCAL0"
|
||||||
|
#syslog_ident = "postgres"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Statistics
|
||||||
|
#
|
||||||
|
#show_parser_stats = false
|
||||||
|
#show_planner_stats = false
|
||||||
|
#show_executor_stats = false
|
||||||
|
#show_query_stats = false
|
||||||
|
#ifdef BTREE_BUILD_STATS
|
||||||
|
#show_btree_build_stats = false
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Lock Tracing
|
||||||
|
#
|
||||||
|
#trace_notify = false
|
||||||
|
#ifdef LOCK_DEBUG
|
||||||
|
#trace_locks = false
|
||||||
|
#trace_userlocks = false
|
||||||
|
#trace_spinlocks = false
|
||||||
|
#debug_deadlocks = false
|
||||||
|
#trace_lock_oidmin = 16384
|
||||||
|
#trace_lock_table = 0
|
||||||
|
#endif
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: cost.h,v 1.35 2000/10/05 19:48:33 momjian Exp $
|
* $Id: cost.h,v 1.36 2001/01/24 18:37:31 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
/* defaults for costsize.c's Cost parameters */
|
/* defaults for costsize.c's Cost parameters */
|
||||||
/* NB: cost-estimation code should use the variables, not these constants! */
|
/* NB: cost-estimation code should use the variables, not these constants! */
|
||||||
|
/* If you change these, update backend/utils/misc/postgresql.sample.conf */
|
||||||
#define DEFAULT_EFFECTIVE_CACHE_SIZE 1000.0 /* measured in pages */
|
#define DEFAULT_EFFECTIVE_CACHE_SIZE 1000.0 /* measured in pages */
|
||||||
#define DEFAULT_RANDOM_PAGE_COST 4.0
|
#define DEFAULT_RANDOM_PAGE_COST 4.0
|
||||||
#define DEFAULT_CPU_TUPLE_COST 0.01
|
#define DEFAULT_CPU_TUPLE_COST 0.01
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: geqo.h,v 1.21 2000/09/19 18:42:32 tgl Exp $
|
* $Id: geqo.h,v 1.22 2001/01/24 18:37:31 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -45,6 +45,7 @@
|
||||||
/*
|
/*
|
||||||
* Configuration options
|
* Configuration options
|
||||||
*/
|
*/
|
||||||
|
/* If you change these, update backend/utils/misc/postgresql.sample.conf */
|
||||||
extern int Geqo_pool_size;
|
extern int Geqo_pool_size;
|
||||||
#define DEFAULT_GEQO_POOL_SIZE 0 /* = default based on no. of relations. */
|
#define DEFAULT_GEQO_POOL_SIZE 0 /* = default based on no. of relations. */
|
||||||
#define MIN_GEQO_POOL_SIZE 128
|
#define MIN_GEQO_POOL_SIZE 128
|
||||||
|
@ -54,6 +55,7 @@ extern int Geqo_effort; /* 1 .. inf, only used to calculate generations
|
||||||
extern int Geqo_generations; /* 1 .. inf, or 0 to use default based on pool size */
|
extern int Geqo_generations; /* 1 .. inf, or 0 to use default based on pool size */
|
||||||
|
|
||||||
extern double Geqo_selection_bias;
|
extern double Geqo_selection_bias;
|
||||||
|
/* If you change these, update backend/utils/misc/postgresql.sample.conf */
|
||||||
#define DEFAULT_GEQO_SELECTION_BIAS 2.0
|
#define DEFAULT_GEQO_SELECTION_BIAS 2.0
|
||||||
#define MIN_GEQO_SELECTION_BIAS 1.5
|
#define MIN_GEQO_SELECTION_BIAS 1.5
|
||||||
#define MAX_GEQO_SELECTION_BIAS 2.0
|
#define MAX_GEQO_SELECTION_BIAS 2.0
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: paths.h,v 1.49 2000/12/14 22:30:45 tgl Exp $
|
* $Id: paths.h,v 1.50 2001/01/24 18:37:31 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -18,6 +18,7 @@
|
||||||
#include "nodes/relation.h"
|
#include "nodes/relation.h"
|
||||||
|
|
||||||
/* default GEQO threshold (default value for geqo_rels) */
|
/* default GEQO threshold (default value for geqo_rels) */
|
||||||
|
/* If you change this, update backend/utils/misc/postgresql.sample.conf */
|
||||||
#define DEFAULT_GEQO_RELS 11
|
#define DEFAULT_GEQO_RELS 11
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue