PostgreSQL Source Code git master
Loading...
Searching...
No Matches
guc_tables.h File Reference
#include "lib/ilist.h"
#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_bool
 
struct  config_int
 
struct  config_real
 
struct  config_string
 
struct  config_enum
 
struct  config_generic
 

Macros

#define GUC_IS_IN_FILE   0x0001 /* found it in config file */
 
#define GUC_PENDING_RESTART   0x0002 /* changed value cannot be applied yet */
 
#define GUC_NEEDS_REPORT   0x0004 /* new value must be reported to client */
 

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_SETTINGS , CONN_AUTH_TCP ,
  CONN_AUTH_AUTH , CONN_AUTH_SSL , RESOURCES_MEM , RESOURCES_DISK ,
  RESOURCES_KERNEL , RESOURCES_BGWRITER , RESOURCES_IO , RESOURCES_WORKER_PROCESSES ,
  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 , VACUUM_AUTOVACUUM , VACUUM_COST_DELAY , VACUUM_DEFAULT ,
  VACUUM_FREEZING , 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
}
 
enum  GucStackState { GUC_SAVE , GUC_SET , GUC_LOCAL , GUC_SET_LOCAL }
 

Functions

struct config_genericfind_option (const char *name, bool create_placeholders, bool skip_errors, int elevel)
 
struct config_generic ** get_explain_guc_options (int *num)
 
charShowGUCOption (const struct config_generic *record, bool use_units)
 
bool ConfigOptionIsVisible (const struct config_generic *conf)
 
struct config_generic ** get_guc_variables (int *num_vars)
 
void build_guc_variables (void)
 
const charconfig_enum_lookup_by_value (const struct config_generic *record, int val)
 
bool config_enum_lookup_by_name (const struct config_enum *record, const char *value, int *retval)
 
charconfig_enum_get_options (const struct config_enum *record, const char *prefix, const char *suffix, const char *separator)
 

Variables

PGDLLIMPORT const char *const config_group_names []
 
PGDLLIMPORT const char *const config_type_names []
 
PGDLLIMPORT const char *const GucContext_Names []
 
PGDLLIMPORT const char *const GucSource_Names []
 
PGDLLIMPORT struct config_generic ConfigureNames []
 

Macro Definition Documentation

◆ GUC_IS_IN_FILE

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

Definition at line 294 of file guc_tables.h.

◆ GUC_NEEDS_REPORT

#define GUC_NEEDS_REPORT   0x0004 /* new value must be reported to client */

Definition at line 300 of file guc_tables.h.

◆ GUC_PENDING_RESTART

#define GUC_PENDING_RESTART   0x0002 /* changed value cannot be applied yet */

Definition at line 299 of file guc_tables.h.

Typedef Documentation

◆ config_var_value

◆ GucStack

Enumeration Type Documentation

◆ config_group

Enumerator
UNGROUPED 
FILE_LOCATIONS 
CONN_AUTH_SETTINGS 
CONN_AUTH_TCP 
CONN_AUTH_AUTH 
CONN_AUTH_SSL 
RESOURCES_MEM 
RESOURCES_DISK 
RESOURCES_KERNEL 
RESOURCES_BGWRITER 
RESOURCES_IO 
RESOURCES_WORKER_PROCESSES 
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 
VACUUM_AUTOVACUUM 
VACUUM_COST_DELAY 
VACUUM_DEFAULT 
VACUUM_FREEZING 
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 

Definition at line 55 of file guc_tables.h.

56{
57 UNGROUPED, /* use for options not shown in pg_settings */
105};
@ RESOURCES_KERNEL
Definition guc_tables.h:65
@ CLIENT_CONN_LOCALE
Definition guc_tables.h:95
@ WAL_ARCHIVE_RECOVERY
Definition guc_tables.h:73
@ STATS_CUMULATIVE
Definition guc_tables.h:89
@ CLIENT_CONN_PRELOAD
Definition guc_tables.h:96
@ VACUUM_COST_DELAY
Definition guc_tables.h:91
@ QUERY_TUNING_OTHER
Definition guc_tables.h:83
@ LOGGING_WHERE
Definition guc_tables.h:84
@ CONN_AUTH_AUTH
Definition guc_tables.h:61
@ RESOURCES_WORKER_PROCESSES
Definition guc_tables.h:68
@ VACUUM_FREEZING
Definition guc_tables.h:93
@ ERROR_HANDLING_OPTIONS
Definition guc_tables.h:101
@ PROCESS_TITLE
Definition guc_tables.h:87
@ RESOURCES_DISK
Definition guc_tables.h:64
@ REPLICATION_SENDING
Definition guc_tables.h:76
@ RESOURCES_IO
Definition guc_tables.h:67
@ LOCK_MANAGEMENT
Definition guc_tables.h:98
@ CUSTOM_OPTIONS
Definition guc_tables.h:103
@ REPLICATION_PRIMARY
Definition guc_tables.h:77
@ STATS_MONITORING
Definition guc_tables.h:88
@ WAL_RECOVERY_TARGET
Definition guc_tables.h:74
@ WAL_RECOVERY
Definition guc_tables.h:72
@ CONN_AUTH_SSL
Definition guc_tables.h:62
@ RESOURCES_MEM
Definition guc_tables.h:63
@ RESOURCES_BGWRITER
Definition guc_tables.h:66
@ PRESET_OPTIONS
Definition guc_tables.h:102
@ DEVELOPER_OPTIONS
Definition guc_tables.h:104
@ QUERY_TUNING_METHOD
Definition guc_tables.h:80
@ LOGGING_WHAT
Definition guc_tables.h:86
@ VACUUM_DEFAULT
Definition guc_tables.h:92
@ QUERY_TUNING_GEQO
Definition guc_tables.h:82
@ WAL_SETTINGS
Definition guc_tables.h:69
@ COMPAT_OPTIONS_OTHER
Definition guc_tables.h:100
@ CLIENT_CONN_STATEMENT
Definition guc_tables.h:94
@ FILE_LOCATIONS
Definition guc_tables.h:58
@ REPLICATION_STANDBY
Definition guc_tables.h:78
@ QUERY_TUNING_COST
Definition guc_tables.h:81
@ WAL_ARCHIVING
Definition guc_tables.h:71
@ COMPAT_OPTIONS_PREVIOUS
Definition guc_tables.h:99
@ WAL_CHECKPOINTS
Definition guc_tables.h:70
@ CLIENT_CONN_OTHER
Definition guc_tables.h:97
@ LOGGING_WHEN
Definition guc_tables.h:85
@ CONN_AUTH_TCP
Definition guc_tables.h:60
@ REPLICATION_SUBSCRIBERS
Definition guc_tables.h:79
@ WAL_SUMMARIZATION
Definition guc_tables.h:75
@ CONN_AUTH_SETTINGS
Definition guc_tables.h:59
@ UNGROUPED
Definition guc_tables.h:57
@ VACUUM_AUTOVACUUM
Definition guc_tables.h:90

◆ config_type

Enumerator
PGC_BOOL 
PGC_INT 
PGC_REAL 
PGC_STRING 
PGC_ENUM 

Definition at line 23 of file guc_tables.h.

24{
26 PGC_INT,
30};
@ PGC_BOOL
Definition guc_tables.h:25
@ PGC_STRING
Definition guc_tables.h:28
@ PGC_ENUM
Definition guc_tables.h:29
@ PGC_REAL
Definition guc_tables.h:27
@ PGC_INT
Definition guc_tables.h:26

◆ GucStackState

Enumerator
GUC_SAVE 
GUC_SET 
GUC_LOCAL 
GUC_SET_LOCAL 

Definition at line 111 of file guc_tables.h.

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

Function Documentation

◆ build_guc_variables()

void build_guc_variables ( void  )
extern

Definition at line 871 of file guc.c.

872{
873 int size_vars;
874 int num_vars = 0;
877 bool found;
878
879 /*
880 * Create the memory context that will hold all GUC-related data.
881 */
884 "GUCMemoryContext",
886
887 /*
888 * Count all the built-in variables.
889 */
890 for (int i = 0; ConfigureNames[i].name; i++)
891 num_vars++;
892
893 /*
894 * Create hash table with 20% slack
895 */
896 size_vars = num_vars + num_vars / 4;
897
898 hash_ctl.keysize = sizeof(char *);
899 hash_ctl.entrysize = sizeof(GUCHashEntry);
900 hash_ctl.hash = guc_name_hash;
901 hash_ctl.match = guc_name_match;
903 guc_hashtab = hash_create("GUC hash table",
904 size_vars,
905 &hash_ctl,
907
908 for (int i = 0; ConfigureNames[i].name; i++)
909 {
910 struct config_generic *gucvar = &ConfigureNames[i];
911
913 &gucvar->name,
915 &found);
916 Assert(!found);
917 hentry->gucvar = gucvar;
918 }
919
921}
#define Assert(condition)
Definition c.h:945
void * hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr)
Definition dynahash.c:952
HTAB * hash_create(const char *tabname, int64 nelem, const HASHCTL *info, int flags)
Definition dynahash.c:358
int64 hash_get_num_entries(HTAB *hashp)
Definition dynahash.c:1336
static int guc_name_match(const void *key1, const void *key2, Size keysize)
Definition guc.c:1232
static uint32 guc_name_hash(const void *key, Size keysize)
Definition guc.c:1208
static HTAB * guc_hashtab
Definition guc.c:214
static MemoryContext GUCMemoryContext
Definition guc.c:201
PGDLLIMPORT struct config_generic ConfigureNames[]
@ HASH_ENTER
Definition hsearch.h:114
#define HASH_CONTEXT
Definition hsearch.h:102
#define HASH_ELEM
Definition hsearch.h:95
#define HASH_COMPARE
Definition hsearch.h:99
#define HASH_FUNCTION
Definition hsearch.h:98
int i
Definition isn.c:77
MemoryContext TopMemoryContext
Definition mcxt.c:166
#define AllocSetContextCreate
Definition memutils.h:129
#define ALLOCSET_DEFAULT_SIZES
Definition memutils.h:160
static int fb(int x)
const char * name
Definition guc_tables.h:252

References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, Assert, ConfigureNames, fb(), guc_hashtab, guc_name_hash(), guc_name_match(), GUCMemoryContext, HASH_COMPARE, HASH_CONTEXT, hash_create(), HASH_ELEM, HASH_ENTER, HASH_FUNCTION, hash_get_num_entries(), hash_search(), i, config_generic::name, and TopMemoryContext.

Referenced by GucInfoMain(), and InitializeGUCOptions().

◆ config_enum_get_options()

char * config_enum_get_options ( const struct config_enum record,
const char prefix,
const char suffix,
const char separator 
)
extern

Definition at line 2972 of file guc.c.

2974{
2976 int seplen;
2977
2980
2982 for (const struct config_enum_entry *entry = record->options; entry && entry->name; entry++)
2983 {
2984 if (!entry->hidden)
2985 {
2986 appendStringInfoString(&retstr, entry->name);
2988 }
2989 }
2990
2991 /*
2992 * All the entries may have been hidden, leaving the string empty if no
2993 * prefix was given. This indicates a broken GUC setup, since there is no
2994 * use for an enum without any values, so we just check to make sure we
2995 * don't write to invalid memory instead of actually trying to do
2996 * something smart with it.
2997 */
2998 if (retstr.len >= seplen)
2999 {
3000 /* Replace final separator */
3001 retstr.data[retstr.len - seplen] = '\0';
3002 retstr.len -= seplen;
3003 }
3004
3006
3007 return retstr.data;
3008}
void appendBinaryStringInfo(StringInfo str, const void *data, int datalen)
Definition stringinfo.c:281
void appendStringInfoString(StringInfo str, const char *s)
Definition stringinfo.c:230
void initStringInfo(StringInfo str)
Definition stringinfo.c:97
Definition guc.h:174
const struct config_enum_entry * options
Definition guc_tables.h:205

References appendBinaryStringInfo(), appendStringInfoString(), fb(), initStringInfo(), and config_enum::options.

Referenced by GetConfigOptionValues(), and parse_and_validate_value().

◆ config_enum_lookup_by_name()

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

Definition at line 2948 of file guc.c.

2950{
2951 for (const struct config_enum_entry *entry = record->options; entry && entry->name; entry++)
2952 {
2953 if (pg_strcasecmp(value, entry->name) == 0)
2954 {
2955 *retval = entry->val;
2956 return true;
2957 }
2958 }
2959
2960 *retval = 0;
2961 return false;
2962}
static struct @174 value
int pg_strcasecmp(const char *s1, const char *s2)

References config_enum::options, pg_strcasecmp(), and value.

Referenced by parse_and_validate_value().

◆ config_enum_lookup_by_value()

const char * config_enum_lookup_by_value ( const struct config_generic record,
int  val 
)
extern

Definition at line 2927 of file guc.c.

2928{
2929 for (const struct config_enum_entry *entry = record->_enum.options; entry && entry->name; entry++)
2930 {
2931 if (entry->val == val)
2932 return entry->name;
2933 }
2934
2935 elog(ERROR, "could not find enum option %d for %s",
2936 val, record->name);
2937 return NULL; /* silence compiler */
2938}
#define ERROR
Definition elog.h:39
#define elog(elevel,...)
Definition elog.h:226
long val
Definition informix.c:689
struct config_enum _enum
Definition guc_tables.h:289

References config_generic::_enum, elog, ERROR, fb(), config_generic::name, config_enum::options, and val.

Referenced by call_enum_check_hook(), estimate_variable_size(), GetConfigOption(), GetConfigOptionResetString(), GetConfigOptionValues(), printMixedStruct(), serialize_variable(), and ShowGUCOption().

◆ ConfigOptionIsVisible()

bool ConfigOptionIsVisible ( const struct config_generic conf)
extern

Definition at line 612 of file guc_funcs.c.

613{
614 if ((conf->flags & GUC_SUPERUSER_ONLY) &&
616 return false;
617 else
618 return true;
619}
bool has_privs_of_role(Oid member, Oid role)
Definition acl.c:5314
#define GUC_SUPERUSER_ONLY
Definition guc.h:224
Oid GetUserId(void)
Definition miscinit.c:470

References fb(), GetUserId(), GUC_SUPERUSER_ONLY, and has_privs_of_role().

Referenced by get_explain_guc_options(), GetConfigOption(), GetConfigOptionByName(), GetConfigOptionResetString(), show_all_settings(), and ShowAllGUCConfig().

◆ find_option()

struct config_generic * find_option ( const char name,
bool  create_placeholders,
bool  skip_errors,
int  elevel 
)
extern

Definition at line 1114 of file guc.c.

1116{
1118
1119 Assert(name);
1120
1121 /* Look it up using the hash table. */
1123 &name,
1124 HASH_FIND,
1125 NULL);
1126 if (hentry)
1127 return hentry->gucvar;
1128
1129 /*
1130 * See if the name is an obsolete name for a variable. We assume that the
1131 * set of supported old names is short enough that a brute-force search is
1132 * the best way.
1133 */
1134 for (int i = 0; map_old_guc_names[i] != NULL; i += 2)
1135 {
1137 return find_option(map_old_guc_names[i + 1], false,
1138 skip_errors, elevel);
1139 }
1140
1142 {
1143 /*
1144 * Check if the name is valid, and if so, add a placeholder.
1145 */
1147 return add_placeholder_variable(name, elevel);
1148 else
1149 return NULL; /* error message, if any, already emitted */
1150 }
1151
1152 /* Unknown name and we're not supposed to make a placeholder */
1153 if (!skip_errors)
1154 ereport(elevel,
1156 errmsg("unrecognized configuration parameter \"%s\"",
1157 name)));
1158 return NULL;
1159}
int errcode(int sqlerrcode)
Definition elog.c:874
#define ereport(elevel,...)
Definition elog.h:150
static const char *const map_old_guc_names[]
Definition guc.c:192
static bool assignable_custom_variable_name(const char *name, bool skip_errors, int elevel)
Definition guc.c:1002
struct config_generic * find_option(const char *name, bool create_placeholders, bool skip_errors, int elevel)
Definition guc.c:1114
static struct config_generic * add_placeholder_variable(const char *name, int elevel)
Definition guc.c:1058
int guc_name_compare(const char *namea, const char *nameb)
Definition guc.c:1178
@ HASH_FIND
Definition hsearch.h:113
static char * errmsg
const char * name

References add_placeholder_variable(), Assert, assignable_custom_variable_name(), ereport, errcode(), errmsg, fb(), find_option(), guc_hashtab, guc_name_compare(), HASH_FIND, hash_search(), i, map_old_guc_names, and name.

Referenced by AlterSystemSetConfigFile(), check_GUC_name_for_parameter_acl(), find_option(), flatten_set_variable_args(), get_config_handle(), GetConfigOption(), GetConfigOptionByName(), GetConfigOptionFlags(), GetConfigOptionResetString(), GUCArrayAdd(), GUCArrayDelete(), InitializeWalConsistencyChecking(), pg_settings_get_flags(), ProcessConfigFileInternal(), SelectConfigFiles(), set_config_sourcefile(), set_config_with_handle(), and validate_option_array_item().

◆ get_explain_guc_options()

struct config_generic ** get_explain_guc_options ( int num)
extern

Definition at line 5232 of file guc.c.

5233{
5234 struct config_generic **result;
5235 dlist_iter iter;
5236
5237 *num = 0;
5238
5239 /*
5240 * While only a fraction of all the GUC variables are marked GUC_EXPLAIN,
5241 * it doesn't seem worth dynamically resizing this array.
5242 */
5244
5245 /* We need only consider GUCs with source not PGC_S_DEFAULT */
5247 {
5249 nondef_link, iter.cur);
5250 bool modified;
5251
5252 /* return only parameters marked for inclusion in explain */
5253 if (!(conf->flags & GUC_EXPLAIN))
5254 continue;
5255
5256 /* return only options visible to the current user */
5258 continue;
5259
5260 /* return only options that are different from their boot values */
5261 modified = false;
5262
5263 switch (conf->vartype)
5264 {
5265 case PGC_BOOL:
5266 {
5267 struct config_bool *lconf = &conf->_bool;
5268
5269 modified = (lconf->boot_val != *(lconf->variable));
5270 }
5271 break;
5272
5273 case PGC_INT:
5274 {
5275 struct config_int *lconf = &conf->_int;
5276
5277 modified = (lconf->boot_val != *(lconf->variable));
5278 }
5279 break;
5280
5281 case PGC_REAL:
5282 {
5283 struct config_real *lconf = &conf->_real;
5284
5285 modified = (lconf->boot_val != *(lconf->variable));
5286 }
5287 break;
5288
5289 case PGC_STRING:
5290 {
5291 struct config_string *lconf = &conf->_string;
5292
5293 if (lconf->boot_val == NULL &&
5294 *lconf->variable == NULL)
5295 modified = false;
5296 else if (lconf->boot_val == NULL ||
5297 *lconf->variable == NULL)
5298 modified = true;
5299 else
5300 modified = (strcmp(lconf->boot_val, *(lconf->variable)) != 0);
5301 }
5302 break;
5303
5304 case PGC_ENUM:
5305 {
5306 struct config_enum *lconf = &conf->_enum;
5307
5308 modified = (lconf->boot_val != *(lconf->variable));
5309 }
5310 break;
5311
5312 default:
5313 elog(ERROR, "unexpected GUC type: %d", conf->vartype);
5314 }
5315
5316 if (!modified)
5317 continue;
5318
5319 /* OK, report it */
5320 result[*num] = conf;
5321 *num = *num + 1;
5322 }
5323
5324 return result;
5325}
#define palloc_array(type, count)
Definition fe_memutils.h:76
static dlist_head guc_nondef_list
Definition guc.c:224
#define GUC_EXPLAIN
Definition guc.h:219
bool ConfigOptionIsVisible(const struct config_generic *conf)
Definition guc_funcs.c:612
#define dlist_foreach(iter, lhead)
Definition ilist.h:623
#define dlist_container(type, membername, ptr)
Definition ilist.h:593
dlist_node nondef_link
Definition guc_tables.h:270
dlist_node * cur
Definition ilist.h:179

References ConfigOptionIsVisible(), dlist_iter::cur, dlist_container, dlist_foreach, elog, ERROR, fb(), GUC_EXPLAIN, guc_hashtab, guc_nondef_list, hash_get_num_entries(), config_generic::nondef_link, palloc_array, PGC_BOOL, PGC_ENUM, PGC_INT, PGC_REAL, and PGC_STRING.

Referenced by ExplainPrintSettings().

◆ get_guc_variables()

struct config_generic ** get_guc_variables ( int num_vars)
extern

Definition at line 840 of file guc.c.

841{
842 struct config_generic **result;
845 int i;
846
848 result = palloc_array(struct config_generic *, *num_vars);
849
850 /* Extract pointers from the hash table */
851 i = 0;
853 while ((hentry = (GUCHashEntry *) hash_seq_search(&status)) != NULL)
854 result[i++] = hentry->gucvar;
855 Assert(i == *num_vars);
856
857 /* Sort by name */
858 qsort(result, *num_vars,
859 sizeof(struct config_generic *), guc_var_compare);
860
861 return result;
862}
void * hash_seq_search(HASH_SEQ_STATUS *status)
Definition dynahash.c:1415
void hash_seq_init(HASH_SEQ_STATUS *status, HTAB *hashp)
Definition dynahash.c:1380
static int guc_var_compare(const void *a, const void *b)
Definition guc.c:1166
#define qsort(a, b, c, d)
Definition port.h:495

References Assert, fb(), guc_hashtab, guc_var_compare(), hash_get_num_entries(), hash_seq_init(), hash_seq_search(), i, palloc_array, qsort, and config_generic::status.

Referenced by GucInfoMain(), show_all_settings(), and ShowAllGUCConfig().

◆ ShowGUCOption()

char * ShowGUCOption ( const struct config_generic record,
bool  use_units 
)
extern

Definition at line 5366 of file guc.c.

5367{
5368 char buffer[256];
5369 const char *val;
5370
5371 switch (record->vartype)
5372 {
5373 case PGC_BOOL:
5374 {
5375 const struct config_bool *conf = &record->_bool;
5376
5377 if (conf->show_hook)
5378 val = conf->show_hook();
5379 else
5380 val = *conf->variable ? "on" : "off";
5381 }
5382 break;
5383
5384 case PGC_INT:
5385 {
5386 const struct config_int *conf = &record->_int;
5387
5388 if (conf->show_hook)
5389 val = conf->show_hook();
5390 else
5391 {
5392 /*
5393 * Use int64 arithmetic to avoid overflows in units
5394 * conversion.
5395 */
5396 int64 result = *conf->variable;
5397 const char *unit;
5398
5399 if (use_units && result > 0 && (record->flags & GUC_UNIT))
5401 record->flags & GUC_UNIT,
5402 &result, &unit);
5403 else
5404 unit = "";
5405
5406 snprintf(buffer, sizeof(buffer), INT64_FORMAT "%s",
5407 result, unit);
5408 val = buffer;
5409 }
5410 }
5411 break;
5412
5413 case PGC_REAL:
5414 {
5415 const struct config_real *conf = &record->_real;
5416
5417 if (conf->show_hook)
5418 val = conf->show_hook();
5419 else
5420 {
5421 double result = *conf->variable;
5422 const char *unit;
5423
5424 if (use_units && result > 0 && (record->flags & GUC_UNIT))
5426 record->flags & GUC_UNIT,
5427 &result, &unit);
5428 else
5429 unit = "";
5430
5431 snprintf(buffer, sizeof(buffer), "%g%s",
5432 result, unit);
5433 val = buffer;
5434 }
5435 }
5436 break;
5437
5438 case PGC_STRING:
5439 {
5440 const struct config_string *conf = &record->_string;
5441
5442 if (conf->show_hook)
5443 val = conf->show_hook();
5444 else if (*conf->variable && **conf->variable)
5445 val = *conf->variable;
5446 else
5447 val = "";
5448 }
5449 break;
5450
5451 case PGC_ENUM:
5452 {
5453 const struct config_enum *conf = &record->_enum;
5454
5455 if (conf->show_hook)
5456 val = conf->show_hook();
5457 else
5458 val = config_enum_lookup_by_value(record, *conf->variable);
5459 }
5460 break;
5461
5462 default:
5463 /* just to keep compiler quiet */
5464 val = "???";
5465 break;
5466 }
5467
5468 return pstrdup(val);
5469}
#define INT64_FORMAT
Definition c.h:636
int64_t int64
Definition c.h:615
const char * config_enum_lookup_by_value(const struct config_generic *record, int val)
Definition guc.c:2927
static void convert_int_from_base_unit(int64 base_value, int base_unit, int64 *value, const char **unit)
Definition guc.c:2635
static void convert_real_from_base_unit(double base_value, int base_unit, double *value, const char **unit)
Definition guc.c:2676
#define GUC_UNIT
Definition guc.h:244
char * pstrdup(const char *in)
Definition mcxt.c:1781
#define snprintf
Definition port.h:260
GucShowHook show_hook
Definition guc_tables.h:145
GucShowHook show_hook
Definition guc_tables.h:208
struct config_bool _bool
Definition guc_tables.h:285
struct config_string _string
Definition guc_tables.h:288
struct config_real _real
Definition guc_tables.h:287
struct config_int _int
Definition guc_tables.h:286
enum config_type vartype
Definition guc_tables.h:258
GucShowHook show_hook
Definition guc_tables.h:159
GucShowHook show_hook
Definition guc_tables.h:173
GucShowHook show_hook
Definition guc_tables.h:195

References config_generic::_bool, config_generic::_enum, config_generic::_int, config_generic::_real, config_generic::_string, config_enum_lookup_by_value(), convert_int_from_base_unit(), convert_real_from_base_unit(), fb(), config_generic::flags, GUC_UNIT, INT64_FORMAT, PGC_BOOL, PGC_ENUM, PGC_INT, PGC_REAL, PGC_STRING, pstrdup(), config_bool::show_hook, config_int::show_hook, config_real::show_hook, config_string::show_hook, config_enum::show_hook, snprintf, val, and config_generic::vartype.

Referenced by GetConfigOptionByName(), GetConfigOptionValues(), ReportGUCOption(), and ShowAllGUCConfig().

Variable Documentation

◆ config_group_names

PGDLLIMPORT const char* const config_group_names[]
extern

Definition at line 719 of file guc_tables.c.

720{
721 [UNGROUPED] = gettext_noop("Ungrouped"),
722 [FILE_LOCATIONS] = gettext_noop("File Locations"),
723 [CONN_AUTH_SETTINGS] = gettext_noop("Connections and Authentication / Connection Settings"),
724 [CONN_AUTH_TCP] = gettext_noop("Connections and Authentication / TCP Settings"),
725 [CONN_AUTH_AUTH] = gettext_noop("Connections and Authentication / Authentication"),
726 [CONN_AUTH_SSL] = gettext_noop("Connections and Authentication / SSL"),
727 [RESOURCES_MEM] = gettext_noop("Resource Usage / Memory"),
728 [RESOURCES_DISK] = gettext_noop("Resource Usage / Disk"),
729 [RESOURCES_KERNEL] = gettext_noop("Resource Usage / Kernel Resources"),
730 [RESOURCES_BGWRITER] = gettext_noop("Resource Usage / Background Writer"),
731 [RESOURCES_IO] = gettext_noop("Resource Usage / I/O"),
732 [RESOURCES_WORKER_PROCESSES] = gettext_noop("Resource Usage / Worker Processes"),
733 [WAL_SETTINGS] = gettext_noop("Write-Ahead Log / Settings"),
734 [WAL_CHECKPOINTS] = gettext_noop("Write-Ahead Log / Checkpoints"),
735 [WAL_ARCHIVING] = gettext_noop("Write-Ahead Log / Archiving"),
736 [WAL_RECOVERY] = gettext_noop("Write-Ahead Log / Recovery"),
737 [WAL_ARCHIVE_RECOVERY] = gettext_noop("Write-Ahead Log / Archive Recovery"),
738 [WAL_RECOVERY_TARGET] = gettext_noop("Write-Ahead Log / Recovery Target"),
739 [WAL_SUMMARIZATION] = gettext_noop("Write-Ahead Log / Summarization"),
740 [REPLICATION_SENDING] = gettext_noop("Replication / Sending Servers"),
741 [REPLICATION_PRIMARY] = gettext_noop("Replication / Primary Server"),
742 [REPLICATION_STANDBY] = gettext_noop("Replication / Standby Servers"),
743 [REPLICATION_SUBSCRIBERS] = gettext_noop("Replication / Subscribers"),
744 [QUERY_TUNING_METHOD] = gettext_noop("Query Tuning / Planner Method Configuration"),
745 [QUERY_TUNING_COST] = gettext_noop("Query Tuning / Planner Cost Constants"),
746 [QUERY_TUNING_GEQO] = gettext_noop("Query Tuning / Genetic Query Optimizer"),
747 [QUERY_TUNING_OTHER] = gettext_noop("Query Tuning / Other Planner Options"),
748 [LOGGING_WHERE] = gettext_noop("Reporting and Logging / Where to Log"),
749 [LOGGING_WHEN] = gettext_noop("Reporting and Logging / When to Log"),
750 [LOGGING_WHAT] = gettext_noop("Reporting and Logging / What to Log"),
751 [PROCESS_TITLE] = gettext_noop("Reporting and Logging / Process Title"),
752 [STATS_MONITORING] = gettext_noop("Statistics / Monitoring"),
753 [STATS_CUMULATIVE] = gettext_noop("Statistics / Cumulative Query and Index Statistics"),
754 [VACUUM_AUTOVACUUM] = gettext_noop("Vacuuming / Automatic Vacuuming"),
755 [VACUUM_COST_DELAY] = gettext_noop("Vacuuming / Cost-Based Vacuum Delay"),
756 [VACUUM_DEFAULT] = gettext_noop("Vacuuming / Default Behavior"),
757 [VACUUM_FREEZING] = gettext_noop("Vacuuming / Freezing"),
758 [CLIENT_CONN_STATEMENT] = gettext_noop("Client Connection Defaults / Statement Behavior"),
759 [CLIENT_CONN_LOCALE] = gettext_noop("Client Connection Defaults / Locale and Formatting"),
760 [CLIENT_CONN_PRELOAD] = gettext_noop("Client Connection Defaults / Shared Library Preloading"),
761 [CLIENT_CONN_OTHER] = gettext_noop("Client Connection Defaults / Other Defaults"),
762 [LOCK_MANAGEMENT] = gettext_noop("Lock Management"),
763 [COMPAT_OPTIONS_PREVIOUS] = gettext_noop("Version and Platform Compatibility / Previous PostgreSQL Versions"),
764 [COMPAT_OPTIONS_OTHER] = gettext_noop("Version and Platform Compatibility / Other Platforms and Clients"),
765 [ERROR_HANDLING_OPTIONS] = gettext_noop("Error Handling"),
766 [PRESET_OPTIONS] = gettext_noop("Preset Options"),
767 [CUSTOM_OPTIONS] = gettext_noop("Customized Options"),
768 [DEVELOPER_OPTIONS] = gettext_noop("Developer Options"),
769};
#define gettext_noop(x)
Definition c.h:1287

Referenced by GetConfigOptionValues(), and printMixedStruct().

◆ config_type_names

PGDLLIMPORT const char* const config_type_names[]
extern

Definition at line 779 of file guc_tables.c.

780{
781 [PGC_BOOL] = "bool",
782 [PGC_INT] = "integer",
783 [PGC_REAL] = "real",
784 [PGC_STRING] = "string",
785 [PGC_ENUM] = "enum",
786};

Referenced by GetConfigOptionValues().

◆ ConfigureNames

PGDLLIMPORT struct config_generic ConfigureNames[]
extern

Referenced by build_guc_variables().

◆ GucContext_Names

PGDLLIMPORT const char* const GucContext_Names[]
extern

Definition at line 676 of file guc_tables.c.

677{
678 [PGC_INTERNAL] = "internal",
679 [PGC_POSTMASTER] = "postmaster",
680 [PGC_SIGHUP] = "sighup",
681 [PGC_SU_BACKEND] = "superuser-backend",
682 [PGC_BACKEND] = "backend",
683 [PGC_SUSET] = "superuser",
684 [PGC_USERSET] = "user",
685};
@ PGC_SUSET
Definition guc.h:78
@ PGC_INTERNAL
Definition guc.h:73
@ PGC_USERSET
Definition guc.h:79
@ PGC_SU_BACKEND
Definition guc.h:76
@ PGC_POSTMASTER
Definition guc.h:74
@ PGC_SIGHUP
Definition guc.h:75
@ PGC_BACKEND
Definition guc.h:77

Referenced by GetConfigOptionValues(), and printMixedStruct().

◆ GucSource_Names

PGDLLIMPORT const char* const GucSource_Names[]
extern

Definition at line 695 of file guc_tables.c.

696{
697 [PGC_S_DEFAULT] = "default",
698 [PGC_S_DYNAMIC_DEFAULT] = "default",
699 [PGC_S_ENV_VAR] = "environment variable",
700 [PGC_S_FILE] = "configuration file",
701 [PGC_S_ARGV] = "command line",
702 [PGC_S_GLOBAL] = "global",
703 [PGC_S_DATABASE] = "database",
704 [PGC_S_USER] = "user",
705 [PGC_S_DATABASE_USER] = "database user",
706 [PGC_S_CLIENT] = "client",
707 [PGC_S_OVERRIDE] = "override",
708 [PGC_S_INTERACTIVE] = "interactive",
709 [PGC_S_TEST] = "test",
710 [PGC_S_SESSION] = "session",
711};
@ PGC_S_DEFAULT
Definition guc.h:113
@ PGC_S_DYNAMIC_DEFAULT
Definition guc.h:114
@ PGC_S_FILE
Definition guc.h:116
@ PGC_S_GLOBAL
Definition guc.h:118
@ PGC_S_DATABASE
Definition guc.h:119
@ PGC_S_OVERRIDE
Definition guc.h:123
@ PGC_S_ARGV
Definition guc.h:117
@ PGC_S_SESSION
Definition guc.h:126
@ PGC_S_CLIENT
Definition guc.h:122
@ PGC_S_DATABASE_USER
Definition guc.h:121
@ PGC_S_ENV_VAR
Definition guc.h:115
@ PGC_S_USER
Definition guc.h:120
@ PGC_S_TEST
Definition guc.h:125
@ PGC_S_INTERACTIVE
Definition guc.h:124

Referenced by GetConfigOptionValues().