PostgreSQL Source Code  git master
guc_tables.h File Reference
#include "utils/guc.h"
Include dependency graph for guc_tables.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

union  config_var_val
 
struct  config_var_value
 
struct  guc_stack
 
struct  config_generic
 
struct  config_bool
 
struct  config_int
 
struct  config_real
 
struct  config_string
 
struct  config_enum
 

Macros

#define GUC_IS_IN_FILE   0x0001 /* found it in config file */
 
#define GUC_PENDING_RESTART   0x0002
 

Typedefs

typedef struct config_var_value config_var_value
 
typedef struct guc_stack GucStack
 

Enumerations

enum  config_type {
  PGC_BOOL, PGC_INT, PGC_REAL, PGC_STRING,
  PGC_ENUM
}
 
enum  config_group {
  UNGROUPED, FILE_LOCATIONS, CONN_AUTH, CONN_AUTH_SETTINGS,
  CONN_AUTH_AUTH, CONN_AUTH_SSL, RESOURCES, RESOURCES_MEM,
  RESOURCES_DISK, RESOURCES_KERNEL, RESOURCES_VACUUM_DELAY, RESOURCES_BGWRITER,
  RESOURCES_ASYNCHRONOUS, WAL, WAL_SETTINGS, WAL_CHECKPOINTS,
  WAL_ARCHIVING, REPLICATION, REPLICATION_SENDING, REPLICATION_MASTER,
  REPLICATION_STANDBY, REPLICATION_SUBSCRIBERS, QUERY_TUNING, QUERY_TUNING_METHOD,
  QUERY_TUNING_COST, QUERY_TUNING_GEQO, QUERY_TUNING_OTHER, LOGGING,
  LOGGING_WHERE, LOGGING_WHEN, LOGGING_WHAT, PROCESS_TITLE,
  STATS, STATS_MONITORING, STATS_COLLECTOR, AUTOVACUUM,
  CLIENT_CONN, CLIENT_CONN_STATEMENT, CLIENT_CONN_LOCALE, CLIENT_CONN_PRELOAD,
  CLIENT_CONN_OTHER, LOCK_MANAGEMENT, COMPAT_OPTIONS, COMPAT_OPTIONS_PREVIOUS,
  COMPAT_OPTIONS_CLIENT, ERROR_HANDLING_OPTIONS, PRESET_OPTIONS, CUSTOM_OPTIONS,
  DEVELOPER_OPTIONS
}
 
enum  GucStackState { GUC_SAVE, GUC_SET, GUC_LOCAL, GUC_SET_LOCAL }
 

Functions

struct config_generic ** get_guc_variables (void)
 
void build_guc_variables (void)
 
const char * config_enum_lookup_by_value (struct config_enum *record, int val)
 
bool config_enum_lookup_by_name (struct config_enum *record, const char *value, int *retval)
 

Variables

const char *const config_group_names []
 
const char *const config_type_names []
 
const char *const GucContext_Names []
 
const char *const GucSource_Names []
 

Macro Definition Documentation

◆ GUC_IS_IN_FILE

#define GUC_IS_IN_FILE   0x0001 /* found it in config file */

Definition at line 168 of file guc_tables.h.

◆ GUC_PENDING_RESTART

#define GUC_PENDING_RESTART   0x0002

Definition at line 173 of file guc_tables.h.

Referenced by GetConfigOptionByNum(), and set_config_option().

Typedef Documentation

◆ config_var_value

◆ GucStack

Enumeration Type Documentation

◆ config_group

Enumerator
UNGROUPED 
FILE_LOCATIONS 
CONN_AUTH 
CONN_AUTH_SETTINGS 
CONN_AUTH_AUTH 
CONN_AUTH_SSL 
RESOURCES 
RESOURCES_MEM 
RESOURCES_DISK 
RESOURCES_KERNEL 
RESOURCES_VACUUM_DELAY 
RESOURCES_BGWRITER 
RESOURCES_ASYNCHRONOUS 
WAL 
WAL_SETTINGS 
WAL_CHECKPOINTS 
WAL_ARCHIVING 
REPLICATION 
REPLICATION_SENDING 
REPLICATION_MASTER 
REPLICATION_STANDBY 
REPLICATION_SUBSCRIBERS 
QUERY_TUNING 
QUERY_TUNING_METHOD 
QUERY_TUNING_COST 
QUERY_TUNING_GEQO 
QUERY_TUNING_OTHER 
LOGGING 
LOGGING_WHERE 
LOGGING_WHEN 
LOGGING_WHAT 
PROCESS_TITLE 
STATS 
STATS_MONITORING 
STATS_COLLECTOR 
AUTOVACUUM 
CLIENT_CONN 
CLIENT_CONN_STATEMENT 
CLIENT_CONN_LOCALE 
CLIENT_CONN_PRELOAD 
CLIENT_CONN_OTHER 
LOCK_MANAGEMENT 
COMPAT_OPTIONS 
COMPAT_OPTIONS_PREVIOUS 
COMPAT_OPTIONS_CLIENT 
ERROR_HANDLING_OPTIONS 
PRESET_OPTIONS 
CUSTOM_OPTIONS 
DEVELOPER_OPTIONS 

Definition at line 53 of file guc_tables.h.

54 {
55  UNGROUPED,
57  CONN_AUTH,
61  RESOURCES,
68  WAL,
82  LOGGING,
87  STATS,
90  AUTOVACUUM,
104 };
Definition: guc_tables.h:68

◆ config_type

Enumerator
PGC_BOOL 
PGC_INT 
PGC_REAL 
PGC_STRING 
PGC_ENUM 

Definition at line 22 of file guc_tables.h.

23 {
24  PGC_BOOL,
25  PGC_INT,
26  PGC_REAL,
27  PGC_STRING,
28  PGC_ENUM
29 };

◆ GucStackState

Enumerator
GUC_SAVE 
GUC_SET 
GUC_LOCAL 
GUC_SET_LOCAL 

Definition at line 110 of file guc_tables.h.

111 {
112  /* This is almost GucAction, but we need a fourth state for SET+LOCAL */
113  GUC_SAVE, /* entry caused by function SET option */
114  GUC_SET, /* entry caused by plain SET command */
115  GUC_LOCAL, /* entry caused by SET LOCAL command */
116  GUC_SET_LOCAL /* entry caused by SET then SET LOCAL */
117 } GucStackState;
GucStackState
Definition: guc_tables.h:110

Function Documentation

◆ build_guc_variables()

void build_guc_variables ( void  )

Definition at line 4442 of file guc.c.

References FATAL, free, config_bool::gen, config_int::gen, config_real::gen, config_string::gen, config_enum::gen, guc_malloc(), guc_var_compare(), i, config_generic::name, PGC_BOOL, PGC_ENUM, PGC_INT, PGC_REAL, PGC_STRING, qsort, and config_generic::vartype.

Referenced by GucInfoMain(), and InitializeGUCOptions().

4443 {
4444  int size_vars;
4445  int num_vars = 0;
4446  struct config_generic **guc_vars;
4447  int i;
4448 
4449  for (i = 0; ConfigureNamesBool[i].gen.name; i++)
4450  {
4451  struct config_bool *conf = &ConfigureNamesBool[i];
4452 
4453  /* Rather than requiring vartype to be filled in by hand, do this: */
4454  conf->gen.vartype = PGC_BOOL;
4455  num_vars++;
4456  }
4457 
4458  for (i = 0; ConfigureNamesInt[i].gen.name; i++)
4459  {
4460  struct config_int *conf = &ConfigureNamesInt[i];
4461 
4462  conf->gen.vartype = PGC_INT;
4463  num_vars++;
4464  }
4465 
4466  for (i = 0; ConfigureNamesReal[i].gen.name; i++)
4467  {
4468  struct config_real *conf = &ConfigureNamesReal[i];
4469 
4470  conf->gen.vartype = PGC_REAL;
4471  num_vars++;
4472  }
4473 
4474  for (i = 0; ConfigureNamesString[i].gen.name; i++)
4475  {
4476  struct config_string *conf = &ConfigureNamesString[i];
4477 
4478  conf->gen.vartype = PGC_STRING;
4479  num_vars++;
4480  }
4481 
4482  for (i = 0; ConfigureNamesEnum[i].gen.name; i++)
4483  {
4484  struct config_enum *conf = &ConfigureNamesEnum[i];
4485 
4486  conf->gen.vartype = PGC_ENUM;
4487  num_vars++;
4488  }
4489 
4490  /*
4491  * Create table with 20% slack
4492  */
4493  size_vars = num_vars + num_vars / 4;
4494 
4495  guc_vars = (struct config_generic **)
4496  guc_malloc(FATAL, size_vars * sizeof(struct config_generic *));
4497 
4498  num_vars = 0;
4499 
4500  for (i = 0; ConfigureNamesBool[i].gen.name; i++)
4501  guc_vars[num_vars++] = &ConfigureNamesBool[i].gen;
4502 
4503  for (i = 0; ConfigureNamesInt[i].gen.name; i++)
4504  guc_vars[num_vars++] = &ConfigureNamesInt[i].gen;
4505 
4506  for (i = 0; ConfigureNamesReal[i].gen.name; i++)
4507  guc_vars[num_vars++] = &ConfigureNamesReal[i].gen;
4508 
4509  for (i = 0; ConfigureNamesString[i].gen.name; i++)
4510  guc_vars[num_vars++] = &ConfigureNamesString[i].gen;
4511 
4512  for (i = 0; ConfigureNamesEnum[i].gen.name; i++)
4513  guc_vars[num_vars++] = &ConfigureNamesEnum[i].gen;
4514 
4515  if (guc_variables)
4517  guc_variables = guc_vars;
4518  num_guc_variables = num_vars;
4519  size_guc_variables = size_vars;
4521  sizeof(struct config_generic *), guc_var_compare);
4522 }
static struct config_int ConfigureNamesInt[]
Definition: guc.c:1833
const char * name
Definition: guc_tables.h:147
static struct config_enum ConfigureNamesEnum[]
Definition: guc.c:3892
static struct config_bool ConfigureNamesBool[]
Definition: guc.c:818
static int guc_var_compare(const void *a, const void *b)
Definition: guc.c:4664
static int num_guc_variables
Definition: guc.c:4181
#define FATAL
Definition: elog.h:52
struct config_generic gen
Definition: guc_tables.h:180
struct config_generic gen
Definition: guc_tables.h:194
static struct config_generic ** guc_variables
Definition: guc.c:4178
enum config_type vartype
Definition: guc_tables.h:154
static int size_guc_variables
Definition: guc.c:4184
static struct config_real ConfigureNamesReal[]
Definition: guc.c:3066
struct config_generic gen
Definition: guc_tables.h:240
struct config_generic gen
Definition: guc_tables.h:226
#define free(a)
Definition: header.h:65
static struct config_string ConfigureNamesString[]
Definition: guc.c:3267
int i
#define qsort(a, b, c, d)
Definition: port.h:421
static void * guc_malloc(int elevel, size_t size)
Definition: guc.c:4219
struct config_generic gen
Definition: guc_tables.h:210

◆ config_enum_lookup_by_name()

bool config_enum_lookup_by_name ( struct config_enum record,
const char *  value,
int *  retval 
)

Definition at line 5884 of file guc.c.

References config_enum_entry::name, config_enum::options, pg_strcasecmp(), and config_enum_entry::val.

Referenced by parse_and_validate_value().

5886 {
5887  const struct config_enum_entry *entry;
5888 
5889  for (entry = record->options; entry && entry->name; entry++)
5890  {
5891  if (pg_strcasecmp(value, entry->name) == 0)
5892  {
5893  *retval = entry->val;
5894  return true;
5895  }
5896  }
5897 
5898  *retval = 0;
5899  return false;
5900 }
Definition: guc.h:164
int pg_strcasecmp(const char *s1, const char *s2)
Definition: pgstrcasecmp.c:36
const struct config_enum_entry * options
Definition: guc_tables.h:244
int val
Definition: guc.h:167
static struct @131 value
const char * name
Definition: guc.h:166

◆ config_enum_lookup_by_value()

const char* config_enum_lookup_by_value ( struct config_enum record,
int  val 
)

Definition at line 5861 of file guc.c.

References elog, ERROR, config_enum::gen, config_generic::name, config_enum_entry::name, config_enum::options, and config_enum_entry::val.

Referenced by _ShowOption(), call_enum_check_hook(), estimate_variable_size(), GetConfigOption(), GetConfigOptionByNum(), GetConfigOptionResetString(), printMixedStruct(), and serialize_variable().

5862 {
5863  const struct config_enum_entry *entry;
5864 
5865  for (entry = record->options; entry && entry->name; entry++)
5866  {
5867  if (entry->val == val)
5868  return entry->name;
5869  }
5870 
5871  elog(ERROR, "could not find enum option %d for %s",
5872  val, record->gen.name);
5873  return NULL; /* silence compiler */
5874 }
Definition: guc.h:164
const char * name
Definition: guc_tables.h:147
#define ERROR
Definition: elog.h:43
const struct config_enum_entry * options
Definition: guc_tables.h:244
int val
Definition: guc.h:167
struct config_generic gen
Definition: guc_tables.h:240
const char * name
Definition: guc.h:166
#define elog
Definition: elog.h:219
long val
Definition: informix.c:689

◆ get_guc_variables()

struct config_generic** get_guc_variables ( void  )

Definition at line 4430 of file guc.c.

References guc_variables.

Referenced by GucInfoMain().

4431 {
4432  return guc_variables;
4433 }
static struct config_generic ** guc_variables
Definition: guc.c:4178

Variable Documentation

◆ config_group_names

const char* const config_group_names[]

Definition at line 568 of file guc.c.

Referenced by printMixedStruct().

◆ config_type_names

const char* const config_type_names[]

Definition at line 677 of file guc.c.

◆ GucContext_Names

const char* const GucContext_Names[]

Definition at line 531 of file guc.c.

Referenced by printMixedStruct().

◆ GucSource_Names

const char* const GucSource_Names[]

Definition at line 547 of file guc.c.