2003-07-04 18:41:22 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* guc_tables.h
|
|
|
|
* Declarations of tables used by GUC.
|
|
|
|
*
|
|
|
|
* See src/backend/utils/misc/README for design notes.
|
|
|
|
*
|
2003-08-04 04:40:20 +02:00
|
|
|
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
2003-07-04 18:41:22 +02:00
|
|
|
*
|
2004-07-21 22:34:50 +02:00
|
|
|
* $PostgreSQL: pgsql/src/include/utils/guc_tables.h,v 1.14 2004/07/21 20:34:49 momjian Exp $
|
2003-07-04 18:41:22 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2004-07-01 02:52:04 +02:00
|
|
|
#ifndef GUC_TABLES_H
|
|
|
|
#define GUC_TABLES_H 1
|
|
|
|
|
|
|
|
/*
|
|
|
|
* GUC supports these types of variables:
|
|
|
|
*/
|
|
|
|
enum config_type
|
|
|
|
{
|
|
|
|
PGC_BOOL,
|
|
|
|
PGC_INT,
|
|
|
|
PGC_REAL,
|
|
|
|
PGC_STRING
|
|
|
|
};
|
|
|
|
|
|
|
|
union config_var_value
|
|
|
|
{
|
|
|
|
bool boolval;
|
|
|
|
int intval;
|
|
|
|
double realval;
|
|
|
|
char *stringval;
|
|
|
|
};
|
2003-07-04 18:41:22 +02:00
|
|
|
|
|
|
|
/*
|
2003-07-28 21:31:32 +02:00
|
|
|
* Groupings to help organize all the run-time options for display
|
2003-07-04 18:41:22 +02:00
|
|
|
*/
|
|
|
|
enum config_group
|
|
|
|
{
|
|
|
|
UNGROUPED,
|
|
|
|
CONN_AUTH,
|
|
|
|
CONN_AUTH_SETTINGS,
|
|
|
|
CONN_AUTH_SECURITY,
|
|
|
|
RESOURCES,
|
|
|
|
RESOURCES_MEM,
|
|
|
|
RESOURCES_FSM,
|
|
|
|
RESOURCES_KERNEL,
|
|
|
|
WAL,
|
|
|
|
WAL_SETTINGS,
|
|
|
|
WAL_CHECKPOINTS,
|
|
|
|
QUERY_TUNING,
|
|
|
|
QUERY_TUNING_METHOD,
|
|
|
|
QUERY_TUNING_COST,
|
|
|
|
QUERY_TUNING_GEQO,
|
|
|
|
QUERY_TUNING_OTHER,
|
|
|
|
LOGGING,
|
2004-04-05 05:02:11 +02:00
|
|
|
LOGGING_WHERE,
|
2003-07-04 18:41:22 +02:00
|
|
|
LOGGING_WHEN,
|
|
|
|
LOGGING_WHAT,
|
|
|
|
STATS,
|
|
|
|
STATS_MONITORING,
|
|
|
|
STATS_COLLECTOR,
|
|
|
|
CLIENT_CONN,
|
|
|
|
CLIENT_CONN_STATEMENT,
|
|
|
|
CLIENT_CONN_LOCALE,
|
|
|
|
CLIENT_CONN_OTHER,
|
|
|
|
LOCK_MANAGEMENT,
|
|
|
|
COMPAT_OPTIONS,
|
|
|
|
COMPAT_OPTIONS_PREVIOUS,
|
|
|
|
COMPAT_OPTIONS_CLIENT,
|
2003-12-03 19:52:00 +01:00
|
|
|
DEVELOPER_OPTIONS,
|
The patch adresses the TODO list item "Allow external interfaces to
extend the GUC variable set".
Plugin modules like the pl<lang> modules needs a way to declare
configuration parameters. The postmaster has no knowledge of such
modules when it reads the postgresql.conf file. Rather than allowing
totally unknown configuration parameters, the concept of a variable
"class" is introduced. Variables that belongs to a declared classes will
create a placeholder value of string type and will not generate an
error. When a module is loaded, it will declare variables for such a
class and make those variables "consume" any placeholders that has been
defined. Finally, the module will generate warnings for unrecognized
placeholders defined for its class.
More detail:
The design is outlined after the suggestions made by Tom Lane and Joe
Conway in this thread:
http://archives.postgresql.org/pgsql-hackers/2004-02/msg00229.php
A new string variable 'custom_variable_classes' is introduced. This
variable is a comma separated string of identifiers. Each identifier
denots a 'class' that will allow its members to be added without error.
This variable must be defined in postmaster.conf.
The lexer (guc_file.l) is changed so that it can accept a qualified name
in the form <ID>.<ID> as the name of a variable. I also changed so that
the 'custom_variable_classes', if found, is added first of all variables
in order to remove the order of declaration issue.
The guc_variables table is made more dynamic. It is originally created
with 20% slack and can grow dynamically. A capacity is introduced to
avoid resizing every time a new variable is added. guc_variables and
num_guc_variables becomes static (hidden).
The GucInfoMain now uses the new function get_guc_variables() and
GetNumConfigOptions instead or using the guc_variables directly.
The find_option() function, when passed a missing name, will check if
the name is qualified. If the name is qualified and if the qualifier
denotes a class included in the 'custom_variable_classes', a placeholder
variable will be created. Such a placeholder will not participate in a
list operation but will otherwise function as a normal string variable.
Define<type>GucVariable() functions will be added, one for each variable
type. They are inteded to be used by add-on modules like the pl<lang>
mappings. Example:
extern void DefineCustomBoolVariable(
const char* name,
const char* short_desc,
const char* long_desc,
bool* valueAddr,
GucContext context,
GucBoolAssignHook assign_hook,
GucShowHook show_hook);
(I created typedefs for the assign-hook and show-hook functions). A call
to these functions will define a new GUC-variable. If a placeholder
exists it will be replaced but it's value will be used in place of the
default value. The valueAddr is assumed ot point at a default value when
the define function is called. The only constraint that is imposed on a
Custom variable is that its name is qualified.
Finally, a function:
void EmittWarningsOnPlacholders(const char* className)
was added. This function should be called when a module has completed
its variable definitions. At that time, no placeholders should remain
for the class that the module uses. If they do, elog(INFO, ...) messages
will be issued to inform the user that unrecognized variables are
present.
Thomas Hallgren
2004-05-26 17:07:41 +02:00
|
|
|
COMPILE_OPTIONS,
|
|
|
|
CUSTOM_OPTIONS
|
2003-07-04 18:41:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
2004-07-01 02:52:04 +02:00
|
|
|
* Stack entry for saving the state of a variable prior to the current
|
|
|
|
* transaction
|
2003-07-04 18:41:22 +02:00
|
|
|
*/
|
2004-07-01 02:52:04 +02:00
|
|
|
typedef struct guc_stack
|
2003-07-04 18:41:22 +02:00
|
|
|
{
|
2004-07-01 02:52:04 +02:00
|
|
|
struct guc_stack *prev; /* previous stack item, if any */
|
|
|
|
int nest_level; /* nesting depth of cur transaction */
|
|
|
|
int status; /* previous status bits, see below */
|
|
|
|
GucSource tentative_source; /* source of the tentative_value */
|
|
|
|
GucSource source; /* source of the actual value */
|
|
|
|
union config_var_value tentative_val; /* previous tentative val */
|
|
|
|
union config_var_value value; /* previous actual value */
|
|
|
|
} GucStack;
|
2003-07-04 18:41:22 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Generic fields applicable to all types of variables
|
|
|
|
*
|
|
|
|
* The short description should be less than 80 chars in length. Some
|
2003-08-04 02:43:34 +02:00
|
|
|
* applications may use the long description as well, and will append
|
|
|
|
* it to the short description. (separated by a newline or '. ')
|
2003-07-04 18:41:22 +02:00
|
|
|
*/
|
|
|
|
struct config_generic
|
|
|
|
{
|
|
|
|
/* constant fields, must be set correctly in initial value: */
|
|
|
|
const char *name; /* name of variable - MUST BE FIRST */
|
|
|
|
GucContext context; /* context required to set the variable */
|
2003-08-04 02:43:34 +02:00
|
|
|
enum config_group group; /* to help organize variables by function */
|
|
|
|
const char *short_desc; /* short desc. of this variable's purpose */
|
|
|
|
const char *long_desc; /* long desc. of this variable's purpose */
|
2003-07-04 18:41:22 +02:00
|
|
|
int flags; /* flag bits, see below */
|
|
|
|
/* variable fields, initialized at runtime: */
|
|
|
|
enum config_type vartype; /* type of variable (set only at startup) */
|
|
|
|
int status; /* status bits, see below */
|
|
|
|
GucSource reset_source; /* source of the reset_value */
|
|
|
|
GucSource tentative_source; /* source of the tentative_value */
|
|
|
|
GucSource source; /* source of the current actual value */
|
2004-07-01 02:52:04 +02:00
|
|
|
GucStack *stack; /* stacked outside-of-transaction states */
|
2003-07-04 18:41:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/* bit values in flags field */
|
|
|
|
#define GUC_LIST_INPUT 0x0001 /* input can be list format */
|
|
|
|
#define GUC_LIST_QUOTE 0x0002 /* double-quote list elements */
|
|
|
|
#define GUC_NO_SHOW_ALL 0x0004 /* exclude from SHOW ALL */
|
|
|
|
#define GUC_NO_RESET_ALL 0x0008 /* exclude from RESET ALL */
|
|
|
|
#define GUC_REPORT 0x0010 /* auto-report changes to client */
|
2003-08-04 02:43:34 +02:00
|
|
|
#define GUC_NOT_IN_SAMPLE 0x0020 /* not in postgresql.conf.sample */
|
|
|
|
#define GUC_DISALLOW_IN_FILE 0x0040 /* can't set in postgresql.conf */
|
The patch adresses the TODO list item "Allow external interfaces to
extend the GUC variable set".
Plugin modules like the pl<lang> modules needs a way to declare
configuration parameters. The postmaster has no knowledge of such
modules when it reads the postgresql.conf file. Rather than allowing
totally unknown configuration parameters, the concept of a variable
"class" is introduced. Variables that belongs to a declared classes will
create a placeholder value of string type and will not generate an
error. When a module is loaded, it will declare variables for such a
class and make those variables "consume" any placeholders that has been
defined. Finally, the module will generate warnings for unrecognized
placeholders defined for its class.
More detail:
The design is outlined after the suggestions made by Tom Lane and Joe
Conway in this thread:
http://archives.postgresql.org/pgsql-hackers/2004-02/msg00229.php
A new string variable 'custom_variable_classes' is introduced. This
variable is a comma separated string of identifiers. Each identifier
denots a 'class' that will allow its members to be added without error.
This variable must be defined in postmaster.conf.
The lexer (guc_file.l) is changed so that it can accept a qualified name
in the form <ID>.<ID> as the name of a variable. I also changed so that
the 'custom_variable_classes', if found, is added first of all variables
in order to remove the order of declaration issue.
The guc_variables table is made more dynamic. It is originally created
with 20% slack and can grow dynamically. A capacity is introduced to
avoid resizing every time a new variable is added. guc_variables and
num_guc_variables becomes static (hidden).
The GucInfoMain now uses the new function get_guc_variables() and
GetNumConfigOptions instead or using the guc_variables directly.
The find_option() function, when passed a missing name, will check if
the name is qualified. If the name is qualified and if the qualifier
denotes a class included in the 'custom_variable_classes', a placeholder
variable will be created. Such a placeholder will not participate in a
list operation but will otherwise function as a normal string variable.
Define<type>GucVariable() functions will be added, one for each variable
type. They are inteded to be used by add-on modules like the pl<lang>
mappings. Example:
extern void DefineCustomBoolVariable(
const char* name,
const char* short_desc,
const char* long_desc,
bool* valueAddr,
GucContext context,
GucBoolAssignHook assign_hook,
GucShowHook show_hook);
(I created typedefs for the assign-hook and show-hook functions). A call
to these functions will define a new GUC-variable. If a placeholder
exists it will be replaced but it's value will be used in place of the
default value. The valueAddr is assumed ot point at a default value when
the define function is called. The only constraint that is imposed on a
Custom variable is that its name is qualified.
Finally, a function:
void EmittWarningsOnPlacholders(const char* className)
was added. This function should be called when a module has completed
its variable definitions. At that time, no placeholders should remain
for the class that the module uses. If they do, elog(INFO, ...) messages
will be issued to inform the user that unrecognized variables are
present.
Thomas Hallgren
2004-05-26 17:07:41 +02:00
|
|
|
#define GUC_CUSTOM_PLACEHOLDER 0x0080 /* placeholder for a custom variable */
|
2003-07-04 18:41:22 +02:00
|
|
|
|
|
|
|
/* bit values in status field */
|
|
|
|
#define GUC_HAVE_TENTATIVE 0x0001 /* tentative value is defined */
|
|
|
|
#define GUC_HAVE_LOCAL 0x0002 /* a SET LOCAL has been executed */
|
2004-07-01 02:52:04 +02:00
|
|
|
#define GUC_HAVE_STACK 0x0004 /* we have stacked prior value(s) */
|
2003-07-04 18:41:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* GUC records for specific variable types */
|
|
|
|
|
|
|
|
struct config_bool
|
|
|
|
{
|
|
|
|
struct config_generic gen;
|
|
|
|
/* these fields must be set correctly in initial value: */
|
|
|
|
/* (all but reset_val are constants) */
|
|
|
|
bool *variable;
|
|
|
|
bool reset_val;
|
The patch adresses the TODO list item "Allow external interfaces to
extend the GUC variable set".
Plugin modules like the pl<lang> modules needs a way to declare
configuration parameters. The postmaster has no knowledge of such
modules when it reads the postgresql.conf file. Rather than allowing
totally unknown configuration parameters, the concept of a variable
"class" is introduced. Variables that belongs to a declared classes will
create a placeholder value of string type and will not generate an
error. When a module is loaded, it will declare variables for such a
class and make those variables "consume" any placeholders that has been
defined. Finally, the module will generate warnings for unrecognized
placeholders defined for its class.
More detail:
The design is outlined after the suggestions made by Tom Lane and Joe
Conway in this thread:
http://archives.postgresql.org/pgsql-hackers/2004-02/msg00229.php
A new string variable 'custom_variable_classes' is introduced. This
variable is a comma separated string of identifiers. Each identifier
denots a 'class' that will allow its members to be added without error.
This variable must be defined in postmaster.conf.
The lexer (guc_file.l) is changed so that it can accept a qualified name
in the form <ID>.<ID> as the name of a variable. I also changed so that
the 'custom_variable_classes', if found, is added first of all variables
in order to remove the order of declaration issue.
The guc_variables table is made more dynamic. It is originally created
with 20% slack and can grow dynamically. A capacity is introduced to
avoid resizing every time a new variable is added. guc_variables and
num_guc_variables becomes static (hidden).
The GucInfoMain now uses the new function get_guc_variables() and
GetNumConfigOptions instead or using the guc_variables directly.
The find_option() function, when passed a missing name, will check if
the name is qualified. If the name is qualified and if the qualifier
denotes a class included in the 'custom_variable_classes', a placeholder
variable will be created. Such a placeholder will not participate in a
list operation but will otherwise function as a normal string variable.
Define<type>GucVariable() functions will be added, one for each variable
type. They are inteded to be used by add-on modules like the pl<lang>
mappings. Example:
extern void DefineCustomBoolVariable(
const char* name,
const char* short_desc,
const char* long_desc,
bool* valueAddr,
GucContext context,
GucBoolAssignHook assign_hook,
GucShowHook show_hook);
(I created typedefs for the assign-hook and show-hook functions). A call
to these functions will define a new GUC-variable. If a placeholder
exists it will be replaced but it's value will be used in place of the
default value. The valueAddr is assumed ot point at a default value when
the define function is called. The only constraint that is imposed on a
Custom variable is that its name is qualified.
Finally, a function:
void EmittWarningsOnPlacholders(const char* className)
was added. This function should be called when a module has completed
its variable definitions. At that time, no placeholders should remain
for the class that the module uses. If they do, elog(INFO, ...) messages
will be issued to inform the user that unrecognized variables are
present.
Thomas Hallgren
2004-05-26 17:07:41 +02:00
|
|
|
GucBoolAssignHook assign_hook;
|
|
|
|
GucShowHook show_hook;
|
2003-07-04 18:41:22 +02:00
|
|
|
/* variable fields, initialized at runtime: */
|
|
|
|
bool tentative_val;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct config_int
|
|
|
|
{
|
|
|
|
struct config_generic gen;
|
|
|
|
/* these fields must be set correctly in initial value: */
|
|
|
|
/* (all but reset_val are constants) */
|
|
|
|
int *variable;
|
|
|
|
int reset_val;
|
|
|
|
int min;
|
|
|
|
int max;
|
The patch adresses the TODO list item "Allow external interfaces to
extend the GUC variable set".
Plugin modules like the pl<lang> modules needs a way to declare
configuration parameters. The postmaster has no knowledge of such
modules when it reads the postgresql.conf file. Rather than allowing
totally unknown configuration parameters, the concept of a variable
"class" is introduced. Variables that belongs to a declared classes will
create a placeholder value of string type and will not generate an
error. When a module is loaded, it will declare variables for such a
class and make those variables "consume" any placeholders that has been
defined. Finally, the module will generate warnings for unrecognized
placeholders defined for its class.
More detail:
The design is outlined after the suggestions made by Tom Lane and Joe
Conway in this thread:
http://archives.postgresql.org/pgsql-hackers/2004-02/msg00229.php
A new string variable 'custom_variable_classes' is introduced. This
variable is a comma separated string of identifiers. Each identifier
denots a 'class' that will allow its members to be added without error.
This variable must be defined in postmaster.conf.
The lexer (guc_file.l) is changed so that it can accept a qualified name
in the form <ID>.<ID> as the name of a variable. I also changed so that
the 'custom_variable_classes', if found, is added first of all variables
in order to remove the order of declaration issue.
The guc_variables table is made more dynamic. It is originally created
with 20% slack and can grow dynamically. A capacity is introduced to
avoid resizing every time a new variable is added. guc_variables and
num_guc_variables becomes static (hidden).
The GucInfoMain now uses the new function get_guc_variables() and
GetNumConfigOptions instead or using the guc_variables directly.
The find_option() function, when passed a missing name, will check if
the name is qualified. If the name is qualified and if the qualifier
denotes a class included in the 'custom_variable_classes', a placeholder
variable will be created. Such a placeholder will not participate in a
list operation but will otherwise function as a normal string variable.
Define<type>GucVariable() functions will be added, one for each variable
type. They are inteded to be used by add-on modules like the pl<lang>
mappings. Example:
extern void DefineCustomBoolVariable(
const char* name,
const char* short_desc,
const char* long_desc,
bool* valueAddr,
GucContext context,
GucBoolAssignHook assign_hook,
GucShowHook show_hook);
(I created typedefs for the assign-hook and show-hook functions). A call
to these functions will define a new GUC-variable. If a placeholder
exists it will be replaced but it's value will be used in place of the
default value. The valueAddr is assumed ot point at a default value when
the define function is called. The only constraint that is imposed on a
Custom variable is that its name is qualified.
Finally, a function:
void EmittWarningsOnPlacholders(const char* className)
was added. This function should be called when a module has completed
its variable definitions. At that time, no placeholders should remain
for the class that the module uses. If they do, elog(INFO, ...) messages
will be issued to inform the user that unrecognized variables are
present.
Thomas Hallgren
2004-05-26 17:07:41 +02:00
|
|
|
GucIntAssignHook assign_hook;
|
|
|
|
GucShowHook show_hook;
|
2003-07-04 18:41:22 +02:00
|
|
|
/* variable fields, initialized at runtime: */
|
|
|
|
int tentative_val;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct config_real
|
|
|
|
{
|
|
|
|
struct config_generic gen;
|
|
|
|
/* these fields must be set correctly in initial value: */
|
|
|
|
/* (all but reset_val are constants) */
|
|
|
|
double *variable;
|
|
|
|
double reset_val;
|
|
|
|
double min;
|
|
|
|
double max;
|
The patch adresses the TODO list item "Allow external interfaces to
extend the GUC variable set".
Plugin modules like the pl<lang> modules needs a way to declare
configuration parameters. The postmaster has no knowledge of such
modules when it reads the postgresql.conf file. Rather than allowing
totally unknown configuration parameters, the concept of a variable
"class" is introduced. Variables that belongs to a declared classes will
create a placeholder value of string type and will not generate an
error. When a module is loaded, it will declare variables for such a
class and make those variables "consume" any placeholders that has been
defined. Finally, the module will generate warnings for unrecognized
placeholders defined for its class.
More detail:
The design is outlined after the suggestions made by Tom Lane and Joe
Conway in this thread:
http://archives.postgresql.org/pgsql-hackers/2004-02/msg00229.php
A new string variable 'custom_variable_classes' is introduced. This
variable is a comma separated string of identifiers. Each identifier
denots a 'class' that will allow its members to be added without error.
This variable must be defined in postmaster.conf.
The lexer (guc_file.l) is changed so that it can accept a qualified name
in the form <ID>.<ID> as the name of a variable. I also changed so that
the 'custom_variable_classes', if found, is added first of all variables
in order to remove the order of declaration issue.
The guc_variables table is made more dynamic. It is originally created
with 20% slack and can grow dynamically. A capacity is introduced to
avoid resizing every time a new variable is added. guc_variables and
num_guc_variables becomes static (hidden).
The GucInfoMain now uses the new function get_guc_variables() and
GetNumConfigOptions instead or using the guc_variables directly.
The find_option() function, when passed a missing name, will check if
the name is qualified. If the name is qualified and if the qualifier
denotes a class included in the 'custom_variable_classes', a placeholder
variable will be created. Such a placeholder will not participate in a
list operation but will otherwise function as a normal string variable.
Define<type>GucVariable() functions will be added, one for each variable
type. They are inteded to be used by add-on modules like the pl<lang>
mappings. Example:
extern void DefineCustomBoolVariable(
const char* name,
const char* short_desc,
const char* long_desc,
bool* valueAddr,
GucContext context,
GucBoolAssignHook assign_hook,
GucShowHook show_hook);
(I created typedefs for the assign-hook and show-hook functions). A call
to these functions will define a new GUC-variable. If a placeholder
exists it will be replaced but it's value will be used in place of the
default value. The valueAddr is assumed ot point at a default value when
the define function is called. The only constraint that is imposed on a
Custom variable is that its name is qualified.
Finally, a function:
void EmittWarningsOnPlacholders(const char* className)
was added. This function should be called when a module has completed
its variable definitions. At that time, no placeholders should remain
for the class that the module uses. If they do, elog(INFO, ...) messages
will be issued to inform the user that unrecognized variables are
present.
Thomas Hallgren
2004-05-26 17:07:41 +02:00
|
|
|
GucRealAssignHook assign_hook;
|
|
|
|
GucShowHook show_hook;
|
2003-07-04 18:41:22 +02:00
|
|
|
/* variable fields, initialized at runtime: */
|
|
|
|
double tentative_val;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct config_string
|
|
|
|
{
|
|
|
|
struct config_generic gen;
|
|
|
|
/* these fields must be set correctly in initial value: */
|
|
|
|
/* (all are constants) */
|
|
|
|
char **variable;
|
|
|
|
const char *boot_val;
|
The patch adresses the TODO list item "Allow external interfaces to
extend the GUC variable set".
Plugin modules like the pl<lang> modules needs a way to declare
configuration parameters. The postmaster has no knowledge of such
modules when it reads the postgresql.conf file. Rather than allowing
totally unknown configuration parameters, the concept of a variable
"class" is introduced. Variables that belongs to a declared classes will
create a placeholder value of string type and will not generate an
error. When a module is loaded, it will declare variables for such a
class and make those variables "consume" any placeholders that has been
defined. Finally, the module will generate warnings for unrecognized
placeholders defined for its class.
More detail:
The design is outlined after the suggestions made by Tom Lane and Joe
Conway in this thread:
http://archives.postgresql.org/pgsql-hackers/2004-02/msg00229.php
A new string variable 'custom_variable_classes' is introduced. This
variable is a comma separated string of identifiers. Each identifier
denots a 'class' that will allow its members to be added without error.
This variable must be defined in postmaster.conf.
The lexer (guc_file.l) is changed so that it can accept a qualified name
in the form <ID>.<ID> as the name of a variable. I also changed so that
the 'custom_variable_classes', if found, is added first of all variables
in order to remove the order of declaration issue.
The guc_variables table is made more dynamic. It is originally created
with 20% slack and can grow dynamically. A capacity is introduced to
avoid resizing every time a new variable is added. guc_variables and
num_guc_variables becomes static (hidden).
The GucInfoMain now uses the new function get_guc_variables() and
GetNumConfigOptions instead or using the guc_variables directly.
The find_option() function, when passed a missing name, will check if
the name is qualified. If the name is qualified and if the qualifier
denotes a class included in the 'custom_variable_classes', a placeholder
variable will be created. Such a placeholder will not participate in a
list operation but will otherwise function as a normal string variable.
Define<type>GucVariable() functions will be added, one for each variable
type. They are inteded to be used by add-on modules like the pl<lang>
mappings. Example:
extern void DefineCustomBoolVariable(
const char* name,
const char* short_desc,
const char* long_desc,
bool* valueAddr,
GucContext context,
GucBoolAssignHook assign_hook,
GucShowHook show_hook);
(I created typedefs for the assign-hook and show-hook functions). A call
to these functions will define a new GUC-variable. If a placeholder
exists it will be replaced but it's value will be used in place of the
default value. The valueAddr is assumed ot point at a default value when
the define function is called. The only constraint that is imposed on a
Custom variable is that its name is qualified.
Finally, a function:
void EmittWarningsOnPlacholders(const char* className)
was added. This function should be called when a module has completed
its variable definitions. At that time, no placeholders should remain
for the class that the module uses. If they do, elog(INFO, ...) messages
will be issued to inform the user that unrecognized variables are
present.
Thomas Hallgren
2004-05-26 17:07:41 +02:00
|
|
|
GucStringAssignHook assign_hook;
|
|
|
|
GucShowHook show_hook;
|
2003-07-04 18:41:22 +02:00
|
|
|
/* variable fields, initialized at runtime: */
|
|
|
|
char *reset_val;
|
|
|
|
char *tentative_val;
|
|
|
|
};
|
|
|
|
|
2003-07-28 21:31:32 +02:00
|
|
|
/* constant tables corresponding to enums above and in guc.h */
|
2003-08-04 02:43:34 +02:00
|
|
|
extern const char *const config_group_names[];
|
|
|
|
extern const char *const config_type_names[];
|
|
|
|
extern const char *const GucContext_Names[];
|
|
|
|
extern const char *const GucSource_Names[];
|
2003-07-28 21:31:32 +02:00
|
|
|
|
The patch adresses the TODO list item "Allow external interfaces to
extend the GUC variable set".
Plugin modules like the pl<lang> modules needs a way to declare
configuration parameters. The postmaster has no knowledge of such
modules when it reads the postgresql.conf file. Rather than allowing
totally unknown configuration parameters, the concept of a variable
"class" is introduced. Variables that belongs to a declared classes will
create a placeholder value of string type and will not generate an
error. When a module is loaded, it will declare variables for such a
class and make those variables "consume" any placeholders that has been
defined. Finally, the module will generate warnings for unrecognized
placeholders defined for its class.
More detail:
The design is outlined after the suggestions made by Tom Lane and Joe
Conway in this thread:
http://archives.postgresql.org/pgsql-hackers/2004-02/msg00229.php
A new string variable 'custom_variable_classes' is introduced. This
variable is a comma separated string of identifiers. Each identifier
denots a 'class' that will allow its members to be added without error.
This variable must be defined in postmaster.conf.
The lexer (guc_file.l) is changed so that it can accept a qualified name
in the form <ID>.<ID> as the name of a variable. I also changed so that
the 'custom_variable_classes', if found, is added first of all variables
in order to remove the order of declaration issue.
The guc_variables table is made more dynamic. It is originally created
with 20% slack and can grow dynamically. A capacity is introduced to
avoid resizing every time a new variable is added. guc_variables and
num_guc_variables becomes static (hidden).
The GucInfoMain now uses the new function get_guc_variables() and
GetNumConfigOptions instead or using the guc_variables directly.
The find_option() function, when passed a missing name, will check if
the name is qualified. If the name is qualified and if the qualifier
denotes a class included in the 'custom_variable_classes', a placeholder
variable will be created. Such a placeholder will not participate in a
list operation but will otherwise function as a normal string variable.
Define<type>GucVariable() functions will be added, one for each variable
type. They are inteded to be used by add-on modules like the pl<lang>
mappings. Example:
extern void DefineCustomBoolVariable(
const char* name,
const char* short_desc,
const char* long_desc,
bool* valueAddr,
GucContext context,
GucBoolAssignHook assign_hook,
GucShowHook show_hook);
(I created typedefs for the assign-hook and show-hook functions). A call
to these functions will define a new GUC-variable. If a placeholder
exists it will be replaced but it's value will be used in place of the
default value. The valueAddr is assumed ot point at a default value when
the define function is called. The only constraint that is imposed on a
Custom variable is that its name is qualified.
Finally, a function:
void EmittWarningsOnPlacholders(const char* className)
was added. This function should be called when a module has completed
its variable definitions. At that time, no placeholders should remain
for the class that the module uses. If they do, elog(INFO, ...) messages
will be issued to inform the user that unrecognized variables are
present.
Thomas Hallgren
2004-05-26 17:07:41 +02:00
|
|
|
/* get the current set of variables */
|
|
|
|
extern struct config_generic **get_guc_variables(void);
|
2003-07-04 18:41:22 +02:00
|
|
|
|
|
|
|
extern void build_guc_variables(void);
|
|
|
|
|
2004-07-01 02:52:04 +02:00
|
|
|
#endif /* GUC_TABLES_H */
|