#ifndef GUC_TABLES_H
#define GUC_TABLES_H 1
#include "lib/ilist.h"
#include "utils/guc.h"
enum config_type
{
PGC_BOOL,
PGC_INT,
PGC_REAL,
PGC_STRING,
PGC_ENUM,
};
union config_var_val
{
bool boolval;
int intval;
double realval;
char *stringval;
int enumval;
};
typedef struct config_var_value
{
union config_var_val val;
void *extra;
} config_var_value;
enum config_group
{
UNGROUPED,
FILE_LOCATIONS,
CONN_AUTH_SETTINGS,
CONN_AUTH_TCP,
CONN_AUTH_AUTH,
CONN_AUTH_SSL,
RESOURCES_MEM,
RESOURCES_DISK,
RESOURCES_KERNEL,
RESOURCES_VACUUM_DELAY,
RESOURCES_BGWRITER,
RESOURCES_ASYNCHRONOUS,
WAL_SETTINGS,
WAL_CHECKPOINTS,
WAL_ARCHIVING,
WAL_RECOVERY,
WAL_ARCHIVE_RECOVERY,
WAL_RECOVERY_TARGET,
WAL_SUMMARIZATION,
REPLICATION_SENDING,
REPLICATION_PRIMARY,
REPLICATION_STANDBY,
REPLICATION_SUBSCRIBERS,
QUERY_TUNING_METHOD,
QUERY_TUNING_COST,
QUERY_TUNING_GEQO,
QUERY_TUNING_OTHER,
LOGGING_WHERE,
LOGGING_WHEN,
LOGGING_WHAT,
PROCESS_TITLE,
STATS_MONITORING,
STATS_CUMULATIVE,
AUTOVACUUM,
CLIENT_CONN_STATEMENT,
CLIENT_CONN_LOCALE,
CLIENT_CONN_PRELOAD,
CLIENT_CONN_OTHER,
LOCK_MANAGEMENT,
COMPAT_OPTIONS_PREVIOUS,
COMPAT_OPTIONS_OTHER,
ERROR_HANDLING_OPTIONS,
PRESET_OPTIONS,
CUSTOM_OPTIONS,
DEVELOPER_OPTIONS,
};
typedef enum
{
GUC_SAVE,
GUC_SET,
GUC_LOCAL,
GUC_SET_LOCAL,
} GucStackState;
typedef struct guc_stack
{
struct guc_stack *prev;
int nest_level;
GucStackState state;
GucSource source;
GucContext scontext;
GucContext masked_scontext;
Oid srole;
Oid masked_srole;
config_var_value prior;
config_var_value masked;
} GucStack;
struct config_generic
{
const char *name;
GucContext context;
enum config_group group;
const char *short_desc;
const char *long_desc;
int flags;
enum config_type vartype;
int status;
GucSource source;
GucSource reset_source;
GucContext scontext;
GucContext reset_scontext;
Oid srole;
Oid reset_srole;
GucStack *stack;
void *extra;
dlist_node nondef_link;
slist_node stack_link;
slist_node report_link;
char *last_reported;
char *sourcefile;
int sourceline;
};
#define GUC_IS_IN_FILE 0x0001
#define GUC_PENDING_RESTART 0x0002
#define GUC_NEEDS_REPORT 0x0004
struct config_bool
{
struct config_generic gen;
bool *variable;
bool boot_val;
GucBoolCheckHook check_hook;
GucBoolAssignHook assign_hook;
GucShowHook show_hook;
bool reset_val;
void *reset_extra;
};
struct config_int
{
struct config_generic gen;
int *variable;
int boot_val;
int min;
int max;
GucIntCheckHook check_hook;
GucIntAssignHook assign_hook;
GucShowHook show_hook;
int reset_val;
void *reset_extra;
};
struct config_real
{
struct config_generic gen;
double *variable;
double boot_val;
double min;
double max;
GucRealCheckHook check_hook;
GucRealAssignHook assign_hook;
GucShowHook show_hook;
double reset_val;
void *reset_extra;
};
struct config_string
{
struct config_generic gen;
char **variable;
const char *boot_val;
GucStringCheckHook check_hook;
GucStringAssignHook assign_hook;
GucShowHook show_hook;
char *reset_val;
void *reset_extra;
};
struct config_enum
{
struct config_generic gen;
int *variable;
int boot_val;
const struct config_enum_entry *options;
GucEnumCheckHook check_hook;
GucEnumAssignHook assign_hook;
GucShowHook show_hook;
int reset_val;
void *reset_extra;
};
extern PGDLLIMPORT const char *const config_group_names[];
extern PGDLLIMPORT const char *const config_type_names[];
extern PGDLLIMPORT const char *const GucContext_Names[];
extern PGDLLIMPORT const char *const GucSource_Names[];
extern PGDLLIMPORT struct config_bool ConfigureNamesBool[];
extern PGDLLIMPORT struct config_int ConfigureNamesInt[];
extern PGDLLIMPORT struct config_real ConfigureNamesReal[];
extern PGDLLIMPORT struct config_string ConfigureNamesString[];
extern PGDLLIMPORT struct config_enum ConfigureNamesEnum[];
extern struct config_generic *find_option(const char *name,
bool create_placeholders,
bool skip_errors,
int elevel);
extern struct config_generic **get_explain_guc_options(int *num);
extern char *ShowGUCOption(struct config_generic *record, bool use_units);
extern bool ConfigOptionIsVisible(struct config_generic *conf);
extern struct config_generic **get_guc_variables(int *num_vars);
extern void build_guc_variables(void);
extern const char *config_enum_lookup_by_value(struct config_enum *record, int val);
extern bool config_enum_lookup_by_name(struct config_enum *record,
const char *value, int *retval);
extern char *config_enum_get_options(struct config_enum *record,
const char *prefix,
const char *suffix,
const char *separator);
#endif