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

Go to the source code of this file.

Functions

bool check_application_name (char **newval, void **extra, GucSource source)
 
void assign_application_name (const char *newval, void *extra)
 
const char * show_archive_command (void)
 
bool check_autovacuum_work_mem (int *newval, void **extra, GucSource source)
 
bool check_vacuum_buffer_usage_limit (int *newval, void **extra, GucSource source)
 
bool check_backtrace_functions (char **newval, void **extra, GucSource source)
 
void assign_backtrace_functions (const char *newval, void *extra)
 
bool check_bonjour (bool *newval, void **extra, GucSource source)
 
bool check_canonical_path (char **newval, void **extra, GucSource source)
 
void assign_checkpoint_completion_target (double newval, void *extra)
 
bool check_client_connection_check_interval (int *newval, void **extra, GucSource source)
 
bool check_client_encoding (char **newval, void **extra, GucSource source)
 
void assign_client_encoding (const char *newval, void *extra)
 
bool check_cluster_name (char **newval, void **extra, GucSource source)
 
bool check_commit_ts_buffers (int *newval, void **extra, GucSource source)
 
const char * show_data_directory_mode (void)
 
bool check_datestyle (char **newval, void **extra, GucSource source)
 
void assign_datestyle (const char *newval, void *extra)
 
bool check_debug_io_direct (char **newval, void **extra, GucSource source)
 
void assign_debug_io_direct (const char *newval, void *extra)
 
bool check_default_table_access_method (char **newval, void **extra, GucSource source)
 
bool check_default_tablespace (char **newval, void **extra, GucSource source)
 
bool check_default_text_search_config (char **newval, void **extra, GucSource source)
 
void assign_default_text_search_config (const char *newval, void *extra)
 
bool check_default_with_oids (bool *newval, void **extra, GucSource source)
 
bool check_effective_io_concurrency (int *newval, void **extra, GucSource source)
 
bool check_huge_page_size (int *newval, void **extra, GucSource source)
 
const char * show_in_hot_standby (void)
 
bool check_locale_messages (char **newval, void **extra, GucSource source)
 
void assign_locale_messages (const char *newval, void *extra)
 
bool check_locale_monetary (char **newval, void **extra, GucSource source)
 
void assign_locale_monetary (const char *newval, void *extra)
 
bool check_locale_numeric (char **newval, void **extra, GucSource source)
 
void assign_locale_numeric (const char *newval, void *extra)
 
bool check_locale_time (char **newval, void **extra, GucSource source)
 
void assign_locale_time (const char *newval, void *extra)
 
bool check_log_destination (char **newval, void **extra, GucSource source)
 
void assign_log_destination (const char *newval, void *extra)
 
const char * show_log_file_mode (void)
 
bool check_log_stats (bool *newval, void **extra, GucSource source)
 
bool check_log_timezone (char **newval, void **extra, GucSource source)
 
void assign_log_timezone (const char *newval, void *extra)
 
const char * show_log_timezone (void)
 
bool check_maintenance_io_concurrency (int *newval, void **extra, GucSource source)
 
void assign_maintenance_io_concurrency (int newval, void *extra)
 
bool check_max_slot_wal_keep_size (int *newval, void **extra, GucSource source)
 
void assign_max_wal_size (int newval, void *extra)
 
bool check_max_stack_depth (int *newval, void **extra, GucSource source)
 
void assign_max_stack_depth (int newval, void *extra)
 
bool check_multixact_member_buffers (int *newval, void **extra, GucSource source)
 
bool check_multixact_offset_buffers (int *newval, void **extra, GucSource source)
 
bool check_notify_buffers (int *newval, void **extra, GucSource source)
 
bool check_primary_slot_name (char **newval, void **extra, GucSource source)
 
bool check_random_seed (double *newval, void **extra, GucSource source)
 
void assign_random_seed (double newval, void *extra)
 
const char * show_random_seed (void)
 
bool check_recovery_prefetch (int *new_value, void **extra, GucSource source)
 
void assign_recovery_prefetch (int new_value, void *extra)
 
bool check_recovery_target (char **newval, void **extra, GucSource source)
 
void assign_recovery_target (const char *newval, void *extra)
 
bool check_recovery_target_lsn (char **newval, void **extra, GucSource source)
 
void assign_recovery_target_lsn (const char *newval, void *extra)
 
bool check_recovery_target_name (char **newval, void **extra, GucSource source)
 
void assign_recovery_target_name (const char *newval, void *extra)
 
bool check_recovery_target_time (char **newval, void **extra, GucSource source)
 
void assign_recovery_target_time (const char *newval, void *extra)
 
bool check_recovery_target_timeline (char **newval, void **extra, GucSource source)
 
void assign_recovery_target_timeline (const char *newval, void *extra)
 
bool check_recovery_target_xid (char **newval, void **extra, GucSource source)
 
void assign_recovery_target_xid (const char *newval, void *extra)
 
bool check_role (char **newval, void **extra, GucSource source)
 
void assign_role (const char *newval, void *extra)
 
const char * show_role (void)
 
bool check_restrict_nonsystem_relation_kind (char **newval, void **extra, GucSource source)
 
void assign_restrict_nonsystem_relation_kind (const char *newval, void *extra)
 
bool check_search_path (char **newval, void **extra, GucSource source)
 
void assign_search_path (const char *newval, void *extra)
 
bool check_serial_buffers (int *newval, void **extra, GucSource source)
 
bool check_session_authorization (char **newval, void **extra, GucSource source)
 
void assign_session_authorization (const char *newval, void *extra)
 
void assign_session_replication_role (int newval, void *extra)
 
void assign_stats_fetch_consistency (int newval, void *extra)
 
bool check_ssl (bool *newval, void **extra, GucSource source)
 
bool check_stage_log_stats (bool *newval, void **extra, GucSource source)
 
bool check_subtrans_buffers (int *newval, void **extra, GucSource source)
 
bool check_synchronous_standby_names (char **newval, void **extra, GucSource source)
 
void assign_synchronous_standby_names (const char *newval, void *extra)
 
void assign_synchronous_commit (int newval, void *extra)
 
void assign_syslog_facility (int newval, void *extra)
 
void assign_syslog_ident (const char *newval, void *extra)
 
void assign_tcp_keepalives_count (int newval, void *extra)
 
const char * show_tcp_keepalives_count (void)
 
void assign_tcp_keepalives_idle (int newval, void *extra)
 
const char * show_tcp_keepalives_idle (void)
 
void assign_tcp_keepalives_interval (int newval, void *extra)
 
const char * show_tcp_keepalives_interval (void)
 
void assign_tcp_user_timeout (int newval, void *extra)
 
const char * show_tcp_user_timeout (void)
 
bool check_temp_buffers (int *newval, void **extra, GucSource source)
 
bool check_temp_tablespaces (char **newval, void **extra, GucSource source)
 
void assign_temp_tablespaces (const char *newval, void *extra)
 
bool check_timezone (char **newval, void **extra, GucSource source)
 
void assign_timezone (const char *newval, void *extra)
 
const char * show_timezone (void)
 
bool check_timezone_abbreviations (char **newval, void **extra, GucSource source)
 
void assign_timezone_abbreviations (const char *newval, void *extra)
 
bool check_transaction_buffers (int *newval, void **extra, GucSource source)
 
bool check_transaction_deferrable (bool *newval, void **extra, GucSource source)
 
bool check_transaction_isolation (int *newval, void **extra, GucSource source)
 
bool check_transaction_read_only (bool *newval, void **extra, GucSource source)
 
void assign_transaction_timeout (int newval, void *extra)
 
const char * show_unix_socket_permissions (void)
 
bool check_wal_buffers (int *newval, void **extra, GucSource source)
 
bool check_wal_consistency_checking (char **newval, void **extra, GucSource source)
 
void assign_wal_consistency_checking (const char *newval, void *extra)
 
bool check_wal_segment_size (int *newval, void **extra, GucSource source)
 
void assign_wal_sync_method (int new_wal_sync_method, void *extra)
 
bool check_synchronized_standby_slots (char **newval, void **extra, GucSource source)
 
void assign_synchronized_standby_slots (const char *newval, void *extra)
 

Function Documentation

◆ assign_application_name()

void assign_application_name ( const char *  newval,
void *  extra 
)

Definition at line 1104 of file variable.c.

1105 {
1106  /* Update the pg_stat_activity view */
1108 }
void pgstat_report_appname(const char *appname)
#define newval

References newval, and pgstat_report_appname().

◆ assign_backtrace_functions()

void assign_backtrace_functions ( const char *  newval,
void *  extra 
)

Definition at line 2226 of file elog.c.

2227 {
2228  backtrace_function_list = (char *) extra;
2229 }
static char * backtrace_function_list
Definition: elog.c:116

References backtrace_function_list.

◆ assign_checkpoint_completion_target()

void assign_checkpoint_completion_target ( double  newval,
void *  extra 
)

Definition at line 2198 of file xlog.c.

2199 {
2202 }
double CheckPointCompletionTarget
Definition: checkpointer.c:138
static void CalculateCheckpointSegments(void)
Definition: xlog.c:2162

References CalculateCheckpointSegments(), CheckPointCompletionTarget, and newval.

◆ assign_client_encoding()

void assign_client_encoding ( const char *  newval,
void *  extra 
)

Definition at line 784 of file variable.c.

785 {
786  int encoding = *((int *) extra);
787 
788  /*
789  * In a parallel worker, we never override the client encoding that was
790  * set by ParallelWorkerMain().
791  */
792  if (IsParallelWorker())
793  return;
794 
795  /* We do not expect an error if PrepareClientEncoding succeeded */
796  if (SetClientEncoding(encoding) < 0)
797  elog(LOG, "SetClientEncoding(%d) failed", encoding);
798 }
#define LOG
Definition: elog.h:31
#define elog(elevel,...)
Definition: elog.h:225
#define IsParallelWorker()
Definition: parallel.h:60
int SetClientEncoding(int encoding)
Definition: mbutils.c:208
int32 encoding
Definition: pg_database.h:41

References elog, encoding, IsParallelWorker, LOG, and SetClientEncoding().

◆ assign_datestyle()

void assign_datestyle ( const char *  newval,
void *  extra 
)

Definition at line 244 of file variable.c.

245 {
246  int *myextra = (int *) extra;
247 
248  DateStyle = myextra[0];
249  DateOrder = myextra[1];
250 }
int DateStyle
Definition: globals.c:124
int DateOrder
Definition: globals.c:125

References DateOrder, and DateStyle.

◆ assign_debug_io_direct()

void assign_debug_io_direct ( const char *  newval,
void *  extra 
)

Definition at line 4050 of file fd.c.

4051 {
4052  int *flags = (int *) extra;
4053 
4054  io_direct_flags = *flags;
4055 }
int io_direct_flags
Definition: fd.c:167

References io_direct_flags.

◆ assign_default_text_search_config()

void assign_default_text_search_config ( const char *  newval,
void *  extra 
)

Definition at line 670 of file ts_cache.c.

671 {
672  /* Just reset the cache to force a lookup on first use */
674 }
#define InvalidOid
Definition: postgres_ext.h:36
static Oid TSCurrentConfigCache
Definition: ts_cache.c:78

References InvalidOid, and TSCurrentConfigCache.

◆ assign_locale_messages()

void assign_locale_messages ( const char *  newval,
void *  extra 
)

Definition at line 439 of file pg_locale.c.

440 {
441  /*
442  * LC_MESSAGES category does not exist everywhere, but accept it anyway.
443  * We ignore failure, as per comment above.
444  */
445 #ifdef LC_MESSAGES
446  (void) pg_perm_setlocale(LC_MESSAGES, newval);
447 #endif
448 }
char * pg_perm_setlocale(int category, const char *locale)
Definition: pg_locale.c:202

References newval, and pg_perm_setlocale().

◆ assign_locale_monetary()

void assign_locale_monetary ( const char *  newval,
void *  extra 
)

Definition at line 376 of file pg_locale.c.

377 {
378  CurrentLocaleConvValid = false;
379 }
static bool CurrentLocaleConvValid
Definition: pg_locale.c:145

References CurrentLocaleConvValid.

◆ assign_locale_numeric()

void assign_locale_numeric ( const char *  newval,
void *  extra 
)

Definition at line 388 of file pg_locale.c.

389 {
390  CurrentLocaleConvValid = false;
391 }

References CurrentLocaleConvValid.

◆ assign_locale_time()

void assign_locale_time ( const char *  newval,
void *  extra 
)

Definition at line 400 of file pg_locale.c.

401 {
402  CurrentLCTimeValid = false;
403 }
static bool CurrentLCTimeValid
Definition: pg_locale.c:146

References CurrentLCTimeValid.

◆ assign_log_destination()

void assign_log_destination ( const char *  newval,
void *  extra 
)

Definition at line 2297 of file elog.c.

2298 {
2299  Log_destination = *((int *) extra);
2300 }
int Log_destination
Definition: elog.c:110

References Log_destination.

◆ assign_log_timezone()

void assign_log_timezone ( const char *  newval,
void *  extra 
)

Definition at line 454 of file variable.c.

455 {
456  log_timezone = *((pg_tz **) extra);
457 }
PGDLLIMPORT pg_tz * log_timezone
Definition: pgtz.c:31
Definition: pgtz.h:66

References log_timezone.

◆ assign_maintenance_io_concurrency()

void assign_maintenance_io_concurrency ( int  newval,
void *  extra 
)

Definition at line 1140 of file variable.c.

1141 {
1142 #ifdef USE_PREFETCH
1143  /*
1144  * Reconfigure recovery prefetching, because a setting it depends on
1145  * changed.
1146  */
1148  if (AmStartupProcess())
1150 #endif
1151 }
int maintenance_io_concurrency
Definition: bufmgr.c:158
#define AmStartupProcess()
Definition: miscadmin.h:380
void XLogPrefetchReconfigure(void)

References AmStartupProcess, maintenance_io_concurrency, newval, and XLogPrefetchReconfigure().

◆ assign_max_stack_depth()

void assign_max_stack_depth ( int  newval,
void *  extra 
)

Definition at line 3638 of file postgres.c.

3639 {
3640  long newval_bytes = newval * 1024L;
3641 
3642  max_stack_depth_bytes = newval_bytes;
3643 }
static long max_stack_depth_bytes
Definition: postgres.c:128

References max_stack_depth_bytes, and newval.

◆ assign_max_wal_size()

void assign_max_wal_size ( int  newval,
void *  extra 
)

Definition at line 2191 of file xlog.c.

2192 {
2195 }
int max_wal_size_mb
Definition: xlog.c:114

References CalculateCheckpointSegments(), max_wal_size_mb, and newval.

◆ assign_random_seed()

void assign_random_seed ( double  newval,
void *  extra 
)

Definition at line 666 of file variable.c.

667 {
668  /* We'll do this at most once for any setting of the GUC variable */
669  if (*((int *) extra))
671  *((int *) extra) = 0;
672 }
Datum Float8GetDatum(float8 X)
Definition: fmgr.c:1816
#define DirectFunctionCall1(func, arg1)
Definition: fmgr.h:641
Datum setseed(PG_FUNCTION_ARGS)

References DirectFunctionCall1, Float8GetDatum(), newval, and setseed().

◆ assign_recovery_prefetch()

void assign_recovery_prefetch ( int  new_value,
void *  extra 
)

Definition at line 1095 of file xlogprefetcher.c.

1096 {
1097  /* Reconfigure prefetching, because a setting it depends on changed. */
1098  recovery_prefetch = new_value;
1099  if (AmStartupProcess())
1101 }
int recovery_prefetch

References AmStartupProcess, recovery_prefetch, and XLogPrefetchReconfigure().

◆ assign_recovery_target()

void assign_recovery_target ( const char *  newval,
void *  extra 
)

Definition at line 4794 of file xlogrecovery.c.

4795 {
4798  error_multiple_recovery_targets();
4799 
4800  if (newval && strcmp(newval, "") != 0)
4802  else
4804 }
RecoveryTargetType recoveryTarget
Definition: xlogrecovery.c:85
@ RECOVERY_TARGET_IMMEDIATE
Definition: xlogrecovery.h:30
@ RECOVERY_TARGET_UNSET
Definition: xlogrecovery.h:25

References newval, RECOVERY_TARGET_IMMEDIATE, RECOVERY_TARGET_UNSET, and recoveryTarget.

◆ assign_recovery_target_lsn()

void assign_recovery_target_lsn ( const char *  newval,
void *  extra 
)

Definition at line 4833 of file xlogrecovery.c.

4834 {
4837  error_multiple_recovery_targets();
4838 
4839  if (newval && strcmp(newval, "") != 0)
4840  {
4842  recoveryTargetLSN = *((XLogRecPtr *) extra);
4843  }
4844  else
4846 }
uint64 XLogRecPtr
Definition: xlogdefs.h:21
XLogRecPtr recoveryTargetLSN
Definition: xlogrecovery.c:92
@ RECOVERY_TARGET_LSN
Definition: xlogrecovery.h:29

References newval, RECOVERY_TARGET_LSN, RECOVERY_TARGET_UNSET, recoveryTarget, and recoveryTargetLSN.

◆ assign_recovery_target_name()

void assign_recovery_target_name ( const char *  newval,
void *  extra 
)

Definition at line 4868 of file xlogrecovery.c.

4869 {
4872  error_multiple_recovery_targets();
4873 
4874  if (newval && strcmp(newval, "") != 0)
4875  {
4878  }
4879  else
4881 }
const char * recoveryTargetName
Definition: xlogrecovery.c:91
@ RECOVERY_TARGET_NAME
Definition: xlogrecovery.h:28

References newval, RECOVERY_TARGET_NAME, RECOVERY_TARGET_UNSET, recoveryTarget, and recoveryTargetName.

◆ assign_recovery_target_time()

void assign_recovery_target_time ( const char *  newval,
void *  extra 
)

Definition at line 4948 of file xlogrecovery.c.

4949 {
4952  error_multiple_recovery_targets();
4953 
4954  if (newval && strcmp(newval, "") != 0)
4956  else
4958 }
@ RECOVERY_TARGET_TIME
Definition: xlogrecovery.h:27

References newval, RECOVERY_TARGET_TIME, RECOVERY_TARGET_UNSET, and recoveryTarget.

◆ assign_recovery_target_timeline()

void assign_recovery_target_timeline ( const char *  newval,
void *  extra 
)

Definition at line 4997 of file xlogrecovery.c.

4998 {
5001  recoveryTargetTLIRequested = (TimeLineID) strtoul(newval, NULL, 0);
5002  else
5004 }
uint32 TimeLineID
Definition: xlogdefs.h:59
RecoveryTargetTimeLineGoal recoveryTargetTimeLineGoal
Definition: xlogrecovery.c:120
TimeLineID recoveryTargetTLIRequested
Definition: xlogrecovery.c:121
RecoveryTargetTimeLineGoal
Definition: xlogrecovery.h:37
@ RECOVERY_TARGET_TIMELINE_NUMERIC
Definition: xlogrecovery.h:40

References newval, RECOVERY_TARGET_TIMELINE_NUMERIC, recoveryTargetTimeLineGoal, and recoveryTargetTLIRequested.

◆ assign_recovery_target_xid()

void assign_recovery_target_xid ( const char *  newval,
void *  extra 
)

Definition at line 5033 of file xlogrecovery.c.

5034 {
5037  error_multiple_recovery_targets();
5038 
5039  if (newval && strcmp(newval, "") != 0)
5040  {
5042  recoveryTargetXid = *((TransactionId *) extra);
5043  }
5044  else
5046 }
uint32 TransactionId
Definition: c.h:606
TransactionId recoveryTargetXid
Definition: xlogrecovery.c:88
@ RECOVERY_TARGET_XID
Definition: xlogrecovery.h:26

References newval, RECOVERY_TARGET_UNSET, RECOVERY_TARGET_XID, recoveryTarget, and recoveryTargetXid.

◆ assign_restrict_nonsystem_relation_kind()

void assign_restrict_nonsystem_relation_kind ( const char *  newval,
void *  extra 
)

Definition at line 3768 of file postgres.c.

3769 {
3770  int *flags = (int *) extra;
3771 
3773 }
int restrict_nonsystem_relation_kind
Definition: postgres.c:107

References restrict_nonsystem_relation_kind.

◆ assign_role()

void assign_role ( const char *  newval,
void *  extra 
)

Definition at line 1024 of file variable.c.

1025 {
1026  role_auth_extra *myextra = (role_auth_extra *) extra;
1027 
1028  SetCurrentRoleId(myextra->roleid, myextra->is_superuser);
1029 }
void SetCurrentRoleId(Oid roleid, bool is_superuser)
Definition: miscinit.c:1009
bool is_superuser
Definition: variable.c:809

References role_auth_extra::is_superuser, role_auth_extra::roleid, and SetCurrentRoleId().

◆ assign_search_path()

void assign_search_path ( const char *  newval,
void *  extra 
)

Definition at line 4713 of file namespace.c.

4714 {
4715  /* don't access search_path during bootstrap */
4717 
4718  /*
4719  * We mark the path as needing recomputation, but don't do anything until
4720  * it's needed. This avoids trying to do database access during GUC
4721  * initialization, or outside a transaction.
4722  *
4723  * This does not invalidate the search path cache, so if this value had
4724  * been previously set and no syscache invalidations happened,
4725  * recomputation may not be necessary.
4726  */
4727  baseSearchPathValid = false;
4728 }
#define Assert(condition)
Definition: c.h:812
#define IsBootstrapProcessingMode()
Definition: miscadmin.h:454
static bool baseSearchPathValid
Definition: namespace.c:158

References Assert, baseSearchPathValid, and IsBootstrapProcessingMode.

◆ assign_session_authorization()

void assign_session_authorization ( const char *  newval,
void *  extra 
)

Definition at line 910 of file variable.c.

911 {
912  role_auth_extra *myextra = (role_auth_extra *) extra;
913 
914  /* Do nothing for the boot_val default of NULL */
915  if (!myextra)
916  return;
917 
918  SetSessionAuthorization(myextra->roleid, myextra->is_superuser);
919 }
void SetSessionAuthorization(Oid userid, bool is_superuser)
Definition: miscinit.c:973

References role_auth_extra::is_superuser, role_auth_extra::roleid, and SetSessionAuthorization().

◆ assign_session_replication_role()

void assign_session_replication_role ( int  newval,
void *  extra 
)

Definition at line 6585 of file trigger.c.

6586 {
6587  /*
6588  * Must flush the plan cache when changing replication role; but don't
6589  * flush unnecessarily.
6590  */
6592  ResetPlanCache();
6593 }
void ResetPlanCache(void)
Definition: plancache.c:2185
int SessionReplicationRole
Definition: trigger.c:63

References newval, ResetPlanCache(), and SessionReplicationRole.

◆ assign_stats_fetch_consistency()

void assign_stats_fetch_consistency ( int  newval,
void *  extra 
)

Definition at line 2069 of file pgstat.c.

2071 {
2072  /*
2073  * Changing this value in a transaction may cause snapshot state
2074  * inconsistencies, so force a clear of the current snapshot on the next
2075  * snapshot build attempt.
2076  */
int pgstat_fetch_consistency
Definition: pgstat.c:204
static bool force_stats_snapshot_clear
Definition: pgstat.c:250

References force_stats_snapshot_clear, newval, and pgstat_fetch_consistency.

◆ assign_synchronized_standby_slots()

void assign_synchronized_standby_slots ( const char *  newval,
void *  extra 
)

Definition at line 2557 of file slot.c.

2558 {
2559  /*
2560  * The standby slots may have changed, so we must recompute the oldest
2561  * LSN.
2562  */
2564 
2566 }
static XLogRecPtr ss_oldest_flush_lsn
Definition: slot.c:157
static SyncStandbySlotsConfigData * synchronized_standby_slots_config
Definition: slot.c:151
#define InvalidXLogRecPtr
Definition: xlogdefs.h:28

References InvalidXLogRecPtr, ss_oldest_flush_lsn, and synchronized_standby_slots_config.

◆ assign_synchronous_commit()

void assign_synchronous_commit ( int  newval,
void *  extra 
)

Definition at line 1055 of file syncrep.c.

1056 {
1057  switch (newval)
1058  {
1061  break;
1064  break;
1067  break;
1068  default:
1070  break;
1071  }
1072 }
static int SyncRepWaitMode
Definition: syncrep.c:98
#define SYNC_REP_NO_WAIT
Definition: syncrep.h:22
#define SYNC_REP_WAIT_WRITE
Definition: syncrep.h:23
#define SYNC_REP_WAIT_FLUSH
Definition: syncrep.h:24
#define SYNC_REP_WAIT_APPLY
Definition: syncrep.h:25
@ SYNCHRONOUS_COMMIT_REMOTE_WRITE
Definition: xact.h:72
@ SYNCHRONOUS_COMMIT_REMOTE_APPLY
Definition: xact.h:75
@ SYNCHRONOUS_COMMIT_REMOTE_FLUSH
Definition: xact.h:74

References newval, SYNC_REP_NO_WAIT, SYNC_REP_WAIT_APPLY, SYNC_REP_WAIT_FLUSH, SYNC_REP_WAIT_WRITE, SYNCHRONOUS_COMMIT_REMOTE_APPLY, SYNCHRONOUS_COMMIT_REMOTE_FLUSH, SYNCHRONOUS_COMMIT_REMOTE_WRITE, and SyncRepWaitMode.

◆ assign_synchronous_standby_names()

void assign_synchronous_standby_names ( const char *  newval,
void *  extra 
)

Definition at line 1049 of file syncrep.c.

1050 {
1051  SyncRepConfig = (SyncRepConfigData *) extra;
1052 }
SyncRepConfigData * SyncRepConfig
Definition: syncrep.c:97

References SyncRepConfig.

◆ assign_syslog_facility()

void assign_syslog_facility ( int  newval,
void *  extra 
)

Definition at line 2338 of file elog.c.

2339 {
2340 #ifdef HAVE_SYSLOG
2341  /*
2342  * As above, don't thrash the syslog connection unnecessarily.
2343  */
2344  if (syslog_facility != newval)
2345  {
2346  if (openlog_done)
2347  {
2348  closelog();
2349  openlog_done = false;
2350  }
2352  }
2353 #endif
2354  /* Without syslog support, just ignore it */
2355 }
static int syslog_facility
Definition: guc_tables.c:586

References newval, and syslog_facility.

◆ assign_syslog_ident()

void assign_syslog_ident ( const char *  newval,
void *  extra 
)

Definition at line 2306 of file elog.c.

2307 {
2308 #ifdef HAVE_SYSLOG
2309  /*
2310  * guc.c is likely to call us repeatedly with same parameters, so don't
2311  * thrash the syslog connection unnecessarily. Also, we do not re-open
2312  * the connection until needed, since this routine will get called whether
2313  * or not Log_destination actually mentions syslog.
2314  *
2315  * Note that we make our own copy of the ident string rather than relying
2316  * on guc.c's. This may be overly paranoid, but it ensures that we cannot
2317  * accidentally free a string that syslog is still using.
2318  */
2319  if (syslog_ident == NULL || strcmp(syslog_ident, newval) != 0)
2320  {
2321  if (openlog_done)
2322  {
2323  closelog();
2324  openlog_done = false;
2325  }
2326  free(syslog_ident);
2327  syslog_ident = strdup(newval);
2328  /* if the strdup fails, we will cope in write_syslog() */
2329  }
2330 #endif
2331  /* Without syslog support, just ignore it */
2332 }
#define free(a)
Definition: header.h:65

References free, and newval.

◆ assign_tcp_keepalives_count()

void assign_tcp_keepalives_count ( int  newval,
void *  extra 
)

Definition at line 2008 of file pqcomm.c.

2009 {
2010  /* See comments in assign_tcp_keepalives_idle */
2012 }
struct Port * MyProcPort
Definition: globals.c:50
int pq_setkeepalivescount(int count, Port *port)
Definition: pqcomm.c:1829

References MyProcPort, newval, and pq_setkeepalivescount().

◆ assign_tcp_keepalives_idle()

void assign_tcp_keepalives_idle ( int  newval,
void *  extra 
)

Definition at line 1952 of file pqcomm.c.

1953 {
1954  /*
1955  * The kernel API provides no way to test a value without setting it; and
1956  * once we set it we might fail to unset it. So there seems little point
1957  * in fully implementing the check-then-assign GUC API for these
1958  * variables. Instead we just do the assignment on demand.
1959  * pq_setkeepalivesidle reports any problems via ereport(LOG).
1960  *
1961  * This approach means that the GUC value might have little to do with the
1962  * actual kernel value, so we use a show_hook that retrieves the kernel
1963  * value rather than trusting GUC's copy.
1964  */
1966 }
int pq_setkeepalivesidle(int idle, Port *port)
Definition: pqcomm.c:1665

References MyProcPort, newval, and pq_setkeepalivesidle().

◆ assign_tcp_keepalives_interval()

void assign_tcp_keepalives_interval ( int  newval,
void *  extra 
)

Definition at line 1985 of file pqcomm.c.

1986 {
1987  /* See comments in assign_tcp_keepalives_idle */
1989 }
int pq_setkeepalivesinterval(int interval, Port *port)
Definition: pqcomm.c:1750

References MyProcPort, newval, and pq_setkeepalivesinterval().

◆ assign_tcp_user_timeout()

void assign_tcp_user_timeout ( int  newval,
void *  extra 
)

Definition at line 2031 of file pqcomm.c.

2032 {
2033  /* See comments in assign_tcp_keepalives_idle */
2035 }
int pq_settcpusertimeout(int timeout, Port *port)
Definition: pqcomm.c:1904

References MyProcPort, newval, and pq_settcpusertimeout().

◆ assign_temp_tablespaces()

void assign_temp_tablespaces ( const char *  newval,
void *  extra 
)

Definition at line 1306 of file tablespace.c.

1307 {
1308  temp_tablespaces_extra *myextra = (temp_tablespaces_extra *) extra;
1309 
1310  /*
1311  * If check_temp_tablespaces was executed inside a transaction, then pass
1312  * the list it made to fd.c. Otherwise, clear fd.c's list; we must be
1313  * still outside a transaction, or else restoring during transaction exit,
1314  * and in either case we can just let the next PrepareTempTablespaces call
1315  * make things sane.
1316  */
1317  if (myextra)
1318  SetTempTablespaces(myextra->tblSpcs, myextra->numSpcs);
1319  else
1320  SetTempTablespaces(NULL, 0);
1321 }
void SetTempTablespaces(Oid *tableSpaces, int numSpaces)
Definition: fd.c:3071
Oid tblSpcs[FLEXIBLE_ARRAY_MEMBER]
Definition: tablespace.c:1193

References temp_tablespaces_extra::numSpcs, SetTempTablespaces(), and temp_tablespaces_extra::tblSpcs.

◆ assign_timezone()

void assign_timezone ( const char *  newval,
void *  extra 
)

Definition at line 381 of file variable.c.

382 {
383  session_timezone = *((pg_tz **) extra);
384 }
PGDLLIMPORT pg_tz * session_timezone
Definition: pgtz.c:28

References session_timezone.

◆ assign_timezone_abbreviations()

void assign_timezone_abbreviations ( const char *  newval,
void *  extra 
)

Definition at line 517 of file variable.c.

518 {
519  /* Do nothing for the boot_val default of NULL */
520  if (!extra)
521  return;
522 
524 }
void InstallTimeZoneAbbrevs(TimeZoneAbbrevTable *tbl)
Definition: datetime.c:4957

References InstallTimeZoneAbbrevs().

◆ assign_transaction_timeout()

void assign_transaction_timeout ( int  newval,
void *  extra 
)

Definition at line 3699 of file postgres.c.

3700 {
3701  if (IsTransactionState())
3702  {
3703  /*
3704  * If transaction_timeout GUC has changed within the transaction block
3705  * enable or disable the timer correspondingly.
3706  */
3709  else if (newval <= 0 && get_timeout_active(TRANSACTION_TIMEOUT))
3711  }
3712 }
void enable_timeout_after(TimeoutId id, int delay_ms)
Definition: timeout.c:560
bool get_timeout_active(TimeoutId id)
Definition: timeout.c:780
void disable_timeout(TimeoutId id, bool keep_indicator)
Definition: timeout.c:685
@ TRANSACTION_TIMEOUT
Definition: timeout.h:34
bool IsTransactionState(void)
Definition: xact.c:386

References disable_timeout(), enable_timeout_after(), get_timeout_active(), IsTransactionState(), newval, and TRANSACTION_TIMEOUT.

◆ assign_wal_consistency_checking()

void assign_wal_consistency_checking ( const char *  newval,
void *  extra 
)

Definition at line 4757 of file xlog.c.

4758 {
4759  /*
4760  * If some checks were deferred, it's possible that the checks will fail
4761  * later during InitializeWalConsistencyChecking(). But in that case, the
4762  * postmaster will exit anyway, so it's safe to proceed with the
4763  * assignment.
4764  *
4765  * Any built-in resource managers specified are assigned immediately,
4766  * which affects WAL created before shared_preload_libraries are
4767  * processed. Any custom resource managers specified won't be assigned
4768  * until after shared_preload_libraries are processed, but that's OK
4769  * because WAL for a custom resource manager can't be written before the
4770  * module is loaded anyway.
4771  */
4772  wal_consistency_checking = extra;
4773 }
bool * wal_consistency_checking
Definition: xlog.c:126

References wal_consistency_checking.

◆ assign_wal_sync_method()

void assign_wal_sync_method ( int  new_wal_sync_method,
void *  extra 
)

Definition at line 8641 of file xlog.c.

8642 {
8643  if (wal_sync_method != new_wal_sync_method)
8644  {
8645  /*
8646  * To ensure that no blocks escape unsynced, force an fsync on the
8647  * currently open log segment (if any). Also, if the open flag is
8648  * changing, close the log file so it will be reopened (with new flag
8649  * bit) at next use.
8650  */
8651  if (openLogFile >= 0)
8652  {
8653  pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC_METHOD_ASSIGN);
8654  if (pg_fsync(openLogFile) != 0)
8655  {
8656  char xlogfname[MAXFNAMELEN];
8657  int save_errno;
8658 
8659  save_errno = errno;
8660  XLogFileName(xlogfname, openLogTLI, openLogSegNo,
8662  errno = save_errno;
8663  ereport(PANIC,
8665  errmsg("could not fsync file \"%s\": %m", xlogfname)));
8666  }
8667 
8669  if (get_sync_bit(wal_sync_method) != get_sync_bit(new_wal_sync_method))
8670  XLogFileClose();
8671  }
8672  }
8673 }
int errcode_for_file_access(void)
Definition: elog.c:876
int errmsg(const char *fmt,...)
Definition: elog.c:1070
#define PANIC
Definition: elog.h:42
#define ereport(elevel,...)
Definition: elog.h:149
int pg_fsync(int fd)
Definition: fd.c:385
static void pgstat_report_wait_start(uint32 wait_event_info)
Definition: wait_event.h:85
static void pgstat_report_wait_end(void)
Definition: wait_event.h:101
static int openLogFile
Definition: xlog.c:635
int wal_segment_size
Definition: xlog.c:143
static int get_sync_bit(int method)
Definition: xlog.c:8593
int wal_sync_method
Definition: xlog.c:130
static TimeLineID openLogTLI
Definition: xlog.c:637
static void XLogFileClose(void)
Definition: xlog.c:3639
static XLogSegNo openLogSegNo
Definition: xlog.c:636
#define MAXFNAMELEN
static void XLogFileName(char *fname, TimeLineID tli, XLogSegNo logSegNo, int wal_segsz_bytes)

References ereport, errcode_for_file_access(), errmsg(), get_sync_bit(), MAXFNAMELEN, openLogFile, openLogSegNo, openLogTLI, PANIC, pg_fsync(), pgstat_report_wait_end(), pgstat_report_wait_start(), wal_segment_size, wal_sync_method, XLogFileClose(), and XLogFileName().

◆ check_application_name()

bool check_application_name ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 1078 of file variable.c.

1079 {
1080  char *clean;
1081  char *ret;
1082 
1083  /* Only allow clean ASCII chars in the application name */
1085  if (!clean)
1086  return false;
1087 
1088  ret = guc_strdup(WARNING, clean);
1089  if (!ret)
1090  {
1091  pfree(clean);
1092  return false;
1093  }
1094 
1095  pfree(clean);
1096  *newval = ret;
1097  return true;
1098 }
#define WARNING
Definition: elog.h:36
#define MCXT_ALLOC_NO_OOM
Definition: fe_memutils.h:29
char * guc_strdup(int elevel, const char *src)
Definition: guc.c:677
void pfree(void *pointer)
Definition: mcxt.c:1521
char * pg_clean_ascii(const char *str, int alloc_flags)
Definition: string.c:85

References guc_strdup(), MCXT_ALLOC_NO_OOM, newval, pfree(), pg_clean_ascii(), and WARNING.

◆ check_autovacuum_work_mem()

bool check_autovacuum_work_mem ( int *  newval,
void **  extra,
GucSource  source 
)

Definition at line 3331 of file autovacuum.c.

3332 {
3333  /*
3334  * -1 indicates fallback.
3335  *
3336  * If we haven't yet changed the boot_val default of -1, just let it be.
3337  * Autovacuum will look to maintenance_work_mem instead.
3338  */
3339  if (*newval == -1)
3340  return true;
3341 
3342  /*
3343  * We clamp manually-set values to at least 64kB. Since
3344  * maintenance_work_mem is always set to at least this value, do the same
3345  * here.
3346  */
3347  if (*newval < 64)
3348  *newval = 64;
3349 
3350  return true;
3351 }

References newval.

◆ check_backtrace_functions()

bool check_backtrace_functions ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 2167 of file elog.c.

2168 {
2169  int newvallen = strlen(*newval);
2170  char *someval;
2171  int validlen;
2172  int i;
2173  int j;
2174 
2175  /*
2176  * Allow characters that can be C identifiers and commas as separators, as
2177  * well as some whitespace for readability.
2178  */
2179  validlen = strspn(*newval,
2180  "0123456789_"
2181  "abcdefghijklmnopqrstuvwxyz"
2182  "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
2183  ", \n\t");
2184  if (validlen != newvallen)
2185  {
2186  GUC_check_errdetail("Invalid character.");
2187  return false;
2188  }
2189 
2190  if (*newval[0] == '\0')
2191  {
2192  *extra = NULL;
2193  return true;
2194  }
2195 
2196  /*
2197  * Allocate space for the output and create the copy. We could discount
2198  * whitespace chars to save some memory, but it doesn't seem worth the
2199  * trouble.
2200  */
2201  someval = guc_malloc(ERROR, newvallen + 1 + 1);
2202  for (i = 0, j = 0; i < newvallen; i++)
2203  {
2204  if ((*newval)[i] == ',')
2205  someval[j++] = '\0'; /* next item */
2206  else if ((*newval)[i] == ' ' ||
2207  (*newval)[i] == '\n' ||
2208  (*newval)[i] == '\t')
2209  ; /* ignore these */
2210  else
2211  someval[j++] = (*newval)[i]; /* copy anything else */
2212  }
2213 
2214  /* two \0s end the setting */
2215  someval[j] = '\0';
2216  someval[j + 1] = '\0';
2217 
2218  *extra = someval;
2219  return true;
2220 }
#define ERROR
Definition: elog.h:39
void * guc_malloc(int elevel, size_t size)
Definition: guc.c:638
#define GUC_check_errdetail
Definition: guc.h:476
int j
Definition: isn.c:73
int i
Definition: isn.c:72

References ERROR, GUC_check_errdetail, guc_malloc(), i, j, and newval.

◆ check_bonjour()

bool check_bonjour ( bool *  newval,
void **  extra,
GucSource  source 
)

Definition at line 1201 of file variable.c.

1202 {
1203 #ifndef USE_BONJOUR
1204  if (*newval)
1205  {
1206  GUC_check_errmsg("Bonjour is not supported by this build");
1207  return false;
1208  }
1209 #endif
1210  return true;
1211 }
#define GUC_check_errmsg
Definition: guc.h:472

References GUC_check_errmsg, and newval.

◆ check_canonical_path()

bool check_canonical_path ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 1057 of file variable.c.

1058 {
1059  /*
1060  * Since canonicalize_path never enlarges the string, we can just modify
1061  * newval in-place. But watch out for NULL, which is the default value
1062  * for external_pid_file.
1063  */
1064  if (*newval)
1066  return true;
1067 }
void canonicalize_path(char *path)
Definition: path.c:265

References canonicalize_path(), and newval.

◆ check_client_connection_check_interval()

bool check_client_connection_check_interval ( int *  newval,
void **  extra,
GucSource  source 
)

Definition at line 3649 of file postgres.c.

3650 {
3651  if (!WaitEventSetCanReportClosed() && *newval != 0)
3652  {
3653  GUC_check_errdetail("\"client_connection_check_interval\" must be set to 0 on this platform.");
3654  return false;
3655  }
3656  return true;
3657 }
bool WaitEventSetCanReportClosed(void)
Definition: latch.c:2241

References GUC_check_errdetail, newval, and WaitEventSetCanReportClosed().

◆ check_client_encoding()

bool check_client_encoding ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 686 of file variable.c.

687 {
688  int encoding;
689  const char *canonical_name;
690 
691  /* Look up the encoding by name */
693  if (encoding < 0)
694  return false;
695 
696  /* Get the canonical name (no aliases, uniform case) */
697  canonical_name = pg_encoding_to_char(encoding);
698 
699  /*
700  * Parallel workers send data to the leader, not the client. They always
701  * send data using the database encoding; therefore, we should never
702  * actually change the client encoding in a parallel worker. However,
703  * during parallel worker startup, we want to accept the leader's
704  * client_encoding setting so that anyone who looks at the value in the
705  * worker sees the same value that they would see in the leader. A change
706  * other than during startup, for example due to a SET clause attached to
707  * a function definition, should be rejected, as there is nothing we can
708  * do inside the worker to make it take effect.
709  */
711  {
712  GUC_check_errcode(ERRCODE_INVALID_TRANSACTION_STATE);
713  GUC_check_errdetail("Cannot change \"client_encoding\" during a parallel operation.");
714  return false;
715  }
716 
717  /*
718  * If we are not within a transaction then PrepareClientEncoding will not
719  * be able to look up the necessary conversion procs. If we are still
720  * starting up, it will return "OK" anyway, and InitializeClientEncoding
721  * will fix things once initialization is far enough along. After
722  * startup, we'll fail. This would only happen if someone tries to change
723  * client_encoding in postgresql.conf and then SIGHUP existing sessions.
724  * It seems like a bad idea for client_encoding to change that way anyhow,
725  * so we don't go out of our way to support it.
726  *
727  * In a parallel worker, we might as well skip PrepareClientEncoding since
728  * we're not going to use its results.
729  *
730  * Note: in the postmaster, or any other process that never calls
731  * InitializeClientEncoding, PrepareClientEncoding will always succeed,
732  * and so will SetClientEncoding; but they won't do anything, which is OK.
733  */
734  if (!IsParallelWorker() &&
736  {
737  if (IsTransactionState())
738  {
739  /* Must be a genuine no-such-conversion problem */
740  GUC_check_errcode(ERRCODE_FEATURE_NOT_SUPPORTED);
741  GUC_check_errdetail("Conversion between %s and %s is not supported.",
742  canonical_name,
744  }
745  else
746  {
747  /* Provide a useful complaint */
748  GUC_check_errdetail("Cannot change \"client_encoding\" now.");
749  }
750  return false;
751  }
752 
753  /*
754  * Replace the user-supplied string with the encoding's canonical name.
755  * This gets rid of aliases and case-folding variations.
756  *
757  * XXX Although canonicalizing seems like a good idea in the abstract, it
758  * breaks pre-9.1 JDBC drivers, which expect that if they send "UNICODE"
759  * as the client_encoding setting then it will read back the same way. As
760  * a workaround, don't replace the string if it's "UNICODE". Remove that
761  * hack when pre-9.1 JDBC drivers are no longer in use.
762  */
763  if (strcmp(*newval, canonical_name) != 0 &&
764  strcmp(*newval, "UNICODE") != 0)
765  {
766  guc_free(*newval);
767  *newval = guc_strdup(LOG, canonical_name);
768  if (!*newval)
769  return false;
770  }
771 
772  /*
773  * Save the encoding's ID in *extra, for use by assign_client_encoding.
774  */
775  *extra = guc_malloc(LOG, sizeof(int));
776  if (!*extra)
777  return false;
778  *((int *) *extra) = encoding;
779 
780  return true;
781 }
bool InitializingParallelWorker
Definition: parallel.c:120
int pg_valid_client_encoding(const char *name)
Definition: encnames.c:485
void GUC_check_errcode(int sqlerrcode)
Definition: guc.c:6785
void guc_free(void *ptr)
Definition: guc.c:689
int PrepareClientEncoding(int encoding)
Definition: mbutils.c:110
const char * GetDatabaseEncodingName(void)
Definition: mbutils.c:1267
#define pg_encoding_to_char
Definition: pg_wchar.h:630

References encoding, GetDatabaseEncodingName(), GUC_check_errcode(), GUC_check_errdetail, guc_free(), guc_malloc(), guc_strdup(), InitializingParallelWorker, IsParallelWorker, IsTransactionState(), LOG, newval, pg_encoding_to_char, pg_valid_client_encoding(), and PrepareClientEncoding().

◆ check_cluster_name()

bool check_cluster_name ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 1114 of file variable.c.

1115 {
1116  char *clean;
1117  char *ret;
1118 
1119  /* Only allow clean ASCII chars in the cluster name */
1121  if (!clean)
1122  return false;
1123 
1124  ret = guc_strdup(WARNING, clean);
1125  if (!ret)
1126  {
1127  pfree(clean);
1128  return false;
1129  }
1130 
1131  pfree(clean);
1132  *newval = ret;
1133  return true;
1134 }

References guc_strdup(), MCXT_ALLOC_NO_OOM, newval, pfree(), pg_clean_ascii(), and WARNING.

◆ check_commit_ts_buffers()

bool check_commit_ts_buffers ( int *  newval,
void **  extra,
GucSource  source 
)

Definition at line 584 of file commit_ts.c.

585 {
586  return check_slru_buffers("commit_timestamp_buffers", newval);
587 }
bool check_slru_buffers(const char *name, int *newval)
Definition: slru.c:355

References check_slru_buffers(), and newval.

◆ check_datestyle()

bool check_datestyle ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 52 of file variable.c.

53 {
54  int newDateStyle = DateStyle;
55  int newDateOrder = DateOrder;
56  bool have_style = false;
57  bool have_order = false;
58  bool ok = true;
59  char *rawstring;
60  int *myextra;
61  char *result;
62  List *elemlist;
63  ListCell *l;
64 
65  /* Need a modifiable copy of string */
66  rawstring = pstrdup(*newval);
67 
68  /* Parse string into list of identifiers */
69  if (!SplitIdentifierString(rawstring, ',', &elemlist))
70  {
71  /* syntax error in list */
72  GUC_check_errdetail("List syntax is invalid.");
73  pfree(rawstring);
74  list_free(elemlist);
75  return false;
76  }
77 
78  foreach(l, elemlist)
79  {
80  char *tok = (char *) lfirst(l);
81 
82  /* Ugh. Somebody ought to write a table driven version -- mjl */
83 
84  if (pg_strcasecmp(tok, "ISO") == 0)
85  {
86  if (have_style && newDateStyle != USE_ISO_DATES)
87  ok = false; /* conflicting styles */
88  newDateStyle = USE_ISO_DATES;
89  have_style = true;
90  }
91  else if (pg_strcasecmp(tok, "SQL") == 0)
92  {
93  if (have_style && newDateStyle != USE_SQL_DATES)
94  ok = false; /* conflicting styles */
95  newDateStyle = USE_SQL_DATES;
96  have_style = true;
97  }
98  else if (pg_strncasecmp(tok, "POSTGRES", 8) == 0)
99  {
100  if (have_style && newDateStyle != USE_POSTGRES_DATES)
101  ok = false; /* conflicting styles */
102  newDateStyle = USE_POSTGRES_DATES;
103  have_style = true;
104  }
105  else if (pg_strcasecmp(tok, "GERMAN") == 0)
106  {
107  if (have_style && newDateStyle != USE_GERMAN_DATES)
108  ok = false; /* conflicting styles */
109  newDateStyle = USE_GERMAN_DATES;
110  have_style = true;
111  /* GERMAN also sets DMY, unless explicitly overridden */
112  if (!have_order)
113  newDateOrder = DATEORDER_DMY;
114  }
115  else if (pg_strcasecmp(tok, "YMD") == 0)
116  {
117  if (have_order && newDateOrder != DATEORDER_YMD)
118  ok = false; /* conflicting orders */
119  newDateOrder = DATEORDER_YMD;
120  have_order = true;
121  }
122  else if (pg_strcasecmp(tok, "DMY") == 0 ||
123  pg_strncasecmp(tok, "EURO", 4) == 0)
124  {
125  if (have_order && newDateOrder != DATEORDER_DMY)
126  ok = false; /* conflicting orders */
127  newDateOrder = DATEORDER_DMY;
128  have_order = true;
129  }
130  else if (pg_strcasecmp(tok, "MDY") == 0 ||
131  pg_strcasecmp(tok, "US") == 0 ||
132  pg_strncasecmp(tok, "NONEURO", 7) == 0)
133  {
134  if (have_order && newDateOrder != DATEORDER_MDY)
135  ok = false; /* conflicting orders */
136  newDateOrder = DATEORDER_MDY;
137  have_order = true;
138  }
139  else if (pg_strcasecmp(tok, "DEFAULT") == 0)
140  {
141  /*
142  * Easiest way to get the current DEFAULT state is to fetch the
143  * DEFAULT string from guc.c and recursively parse it.
144  *
145  * We can't simply "return check_datestyle(...)" because we need
146  * to handle constructs like "DEFAULT, ISO".
147  */
148  char *subval;
149  void *subextra = NULL;
150 
151  subval = guc_strdup(LOG, GetConfigOptionResetString("datestyle"));
152  if (!subval)
153  {
154  ok = false;
155  break;
156  }
157  if (!check_datestyle(&subval, &subextra, source))
158  {
159  guc_free(subval);
160  ok = false;
161  break;
162  }
163  myextra = (int *) subextra;
164  if (!have_style)
165  newDateStyle = myextra[0];
166  if (!have_order)
167  newDateOrder = myextra[1];
168  guc_free(subval);
169  guc_free(subextra);
170  }
171  else
172  {
173  GUC_check_errdetail("Unrecognized key word: \"%s\".", tok);
174  pfree(rawstring);
175  list_free(elemlist);
176  return false;
177  }
178  }
179 
180  pfree(rawstring);
181  list_free(elemlist);
182 
183  if (!ok)
184  {
185  GUC_check_errdetail("Conflicting \"DateStyle\" specifications.");
186  return false;
187  }
188 
189  /*
190  * Prepare the canonical string to return. GUC wants it guc_malloc'd.
191  */
192  result = (char *) guc_malloc(LOG, 32);
193  if (!result)
194  return false;
195 
196  switch (newDateStyle)
197  {
198  case USE_ISO_DATES:
199  strcpy(result, "ISO");
200  break;
201  case USE_SQL_DATES:
202  strcpy(result, "SQL");
203  break;
204  case USE_GERMAN_DATES:
205  strcpy(result, "German");
206  break;
207  default:
208  strcpy(result, "Postgres");
209  break;
210  }
211  switch (newDateOrder)
212  {
213  case DATEORDER_YMD:
214  strcat(result, ", YMD");
215  break;
216  case DATEORDER_DMY:
217  strcat(result, ", DMY");
218  break;
219  default:
220  strcat(result, ", MDY");
221  break;
222  }
223 
224  guc_free(*newval);
225  *newval = result;
226 
227  /*
228  * Set up the "extra" struct actually used by assign_datestyle.
229  */
230  myextra = (int *) guc_malloc(LOG, 2 * sizeof(int));
231  if (!myextra)
232  return false;
233  myextra[0] = newDateStyle;
234  myextra[1] = newDateOrder;
235  *extra = myextra;
236 
237  return true;
238 }
bool check_datestyle(char **newval, void **extra, GucSource source)
Definition: variable.c:52
const char * GetConfigOptionResetString(const char *name)
Definition: guc.c:4405
void list_free(List *list)
Definition: list.c:1546
char * pstrdup(const char *in)
Definition: mcxt.c:1696
#define USE_SQL_DATES
Definition: miscadmin.h:237
#define USE_POSTGRES_DATES
Definition: miscadmin.h:235
#define USE_ISO_DATES
Definition: miscadmin.h:236
#define DATEORDER_DMY
Definition: miscadmin.h:243
#define DATEORDER_MDY
Definition: miscadmin.h:244
#define DATEORDER_YMD
Definition: miscadmin.h:242
#define USE_GERMAN_DATES
Definition: miscadmin.h:238
#define lfirst(lc)
Definition: pg_list.h:172
static rewind_source * source
Definition: pg_rewind.c:89
int pg_strcasecmp(const char *s1, const char *s2)
Definition: pgstrcasecmp.c:36
int pg_strncasecmp(const char *s1, const char *s2, size_t n)
Definition: pgstrcasecmp.c:69
Definition: pg_list.h:54
bool SplitIdentifierString(char *rawstring, char separator, List **namelist)
Definition: varlena.c:3432

References DateOrder, DATEORDER_DMY, DATEORDER_MDY, DATEORDER_YMD, DateStyle, GetConfigOptionResetString(), GUC_check_errdetail, guc_free(), guc_malloc(), guc_strdup(), lfirst, list_free(), LOG, newval, pfree(), pg_strcasecmp(), pg_strncasecmp(), pstrdup(), source, SplitIdentifierString(), USE_GERMAN_DATES, USE_ISO_DATES, USE_POSTGRES_DATES, and USE_SQL_DATES.

◆ check_debug_io_direct()

bool check_debug_io_direct ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 3965 of file fd.c.

3966 {
3967  bool result = true;
3968  int flags;
3969 
3970 #if PG_O_DIRECT == 0
3971  if (strcmp(*newval, "") != 0)
3972  {
3973  GUC_check_errdetail("\"%s\" is not supported on this platform.",
3974  "debug_io_direct");
3975  result = false;
3976  }
3977  flags = 0;
3978 #else
3979  List *elemlist;
3980  ListCell *l;
3981  char *rawstring;
3982 
3983  /* Need a modifiable copy of string */
3984  rawstring = pstrdup(*newval);
3985 
3986  if (!SplitGUCList(rawstring, ',', &elemlist))
3987  {
3988  GUC_check_errdetail("Invalid list syntax in parameter \"%s\".",
3989  "debug_io_direct");
3990  pfree(rawstring);
3991  list_free(elemlist);
3992  return false;
3993  }
3994 
3995  flags = 0;
3996  foreach(l, elemlist)
3997  {
3998  char *item = (char *) lfirst(l);
3999 
4000  if (pg_strcasecmp(item, "data") == 0)
4001  flags |= IO_DIRECT_DATA;
4002  else if (pg_strcasecmp(item, "wal") == 0)
4003  flags |= IO_DIRECT_WAL;
4004  else if (pg_strcasecmp(item, "wal_init") == 0)
4005  flags |= IO_DIRECT_WAL_INIT;
4006  else
4007  {
4008  GUC_check_errdetail("Invalid option \"%s\".", item);
4009  result = false;
4010  break;
4011  }
4012  }
4013 
4014  /*
4015  * It's possible to configure block sizes smaller than our assumed I/O
4016  * alignment size, which could result in invalid I/O requests.
4017  */
4018 #if XLOG_BLCKSZ < PG_IO_ALIGN_SIZE
4019  if (result && (flags & (IO_DIRECT_WAL | IO_DIRECT_WAL_INIT)))
4020  {
4021  GUC_check_errdetail("\"%s\" is not supported for WAL because %s is too small.",
4022  "debug_io_direct", "XLOG_BLCKSZ");
4023  result = false;
4024  }
4025 #endif
4026 #if BLCKSZ < PG_IO_ALIGN_SIZE
4027  if (result && (flags & IO_DIRECT_DATA))
4028  {
4029  GUC_check_errdetail("\"%s\" is not supported for WAL because %s is too small.",
4030  "debug_io_direct", "BLCKSZ");
4031  result = false;
4032  }
4033 #endif
4034 
4035  pfree(rawstring);
4036  list_free(elemlist);
4037 #endif
4038 
4039  if (!result)
4040  return result;
4041 
4042  /* Save the flags in *extra, for use by assign_debug_io_direct */
4043  *extra = guc_malloc(ERROR, sizeof(int));
4044  *((int *) *extra) = flags;
4045 
4046  return result;
4047 }
#define IO_DIRECT_WAL
Definition: fd.h:55
#define IO_DIRECT_DATA
Definition: fd.h:54
#define IO_DIRECT_WAL_INIT
Definition: fd.h:56
bool SplitGUCList(char *rawstring, char separator, List **namelist)
Definition: varlena.c:3680

References ERROR, GUC_check_errdetail, guc_malloc(), IO_DIRECT_DATA, IO_DIRECT_WAL, IO_DIRECT_WAL_INIT, lfirst, list_free(), newval, pfree(), pg_strcasecmp(), pstrdup(), and SplitGUCList().

◆ check_default_table_access_method()

bool check_default_table_access_method ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 105 of file tableamapi.c.

106 {
107  if (**newval == '\0')
108  {
109  GUC_check_errdetail("\"%s\" cannot be empty.",
110  "default_table_access_method");
111  return false;
112  }
113 
114  if (strlen(*newval) >= NAMEDATALEN)
115  {
116  GUC_check_errdetail("\"%s\" is too long (maximum %d characters).",
117  "default_table_access_method", NAMEDATALEN - 1);
118  return false;
119  }
120 
121  /*
122  * If we aren't inside a transaction, or not connected to a database, we
123  * cannot do the catalog access necessary to verify the method. Must
124  * accept the value on faith.
125  */
127  {
128  if (!OidIsValid(get_table_am_oid(*newval, true)))
129  {
130  /*
131  * When source == PGC_S_TEST, don't throw a hard error for a
132  * nonexistent table access method, only a NOTICE. See comments in
133  * guc.h.
134  */
135  if (source == PGC_S_TEST)
136  {
137  ereport(NOTICE,
138  (errcode(ERRCODE_UNDEFINED_OBJECT),
139  errmsg("table access method \"%s\" does not exist",
140  *newval)));
141  }
142  else
143  {
144  GUC_check_errdetail("Table access method \"%s\" does not exist.",
145  *newval);
146  return false;
147  }
148  }
149  }
150 
151  return true;
152 }
Oid get_table_am_oid(const char *amname, bool missing_ok)
Definition: amcmds.c:173
#define OidIsValid(objectId)
Definition: c.h:729
int errcode(int sqlerrcode)
Definition: elog.c:853
#define NOTICE
Definition: elog.h:35
Oid MyDatabaseId
Definition: globals.c:93
@ PGC_S_TEST
Definition: guc.h:121
#define NAMEDATALEN

References ereport, errcode(), errmsg(), get_table_am_oid(), GUC_check_errdetail, InvalidOid, IsTransactionState(), MyDatabaseId, NAMEDATALEN, newval, NOTICE, OidIsValid, PGC_S_TEST, and source.

◆ check_default_tablespace()

bool check_default_tablespace ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 1091 of file tablespace.c.

1092 {
1093  /*
1094  * If we aren't inside a transaction, or connected to a database, we
1095  * cannot do the catalog accesses necessary to verify the name. Must
1096  * accept the value on faith.
1097  */
1099  {
1100  if (**newval != '\0' &&
1102  {
1103  /*
1104  * When source == PGC_S_TEST, don't throw a hard error for a
1105  * nonexistent tablespace, only a NOTICE. See comments in guc.h.
1106  */
1107  if (source == PGC_S_TEST)
1108  {
1109  ereport(NOTICE,
1110  (errcode(ERRCODE_UNDEFINED_OBJECT),
1111  errmsg("tablespace \"%s\" does not exist",
1112  *newval)));
1113  }
1114  else
1115  {
1116  GUC_check_errdetail("Tablespace \"%s\" does not exist.",
1117  *newval);
1118  return false;
1119  }
1120  }
1121  }
1122 
1123  return true;
1124 }
Oid get_tablespace_oid(const char *tablespacename, bool missing_ok)
Definition: tablespace.c:1426

References ereport, errcode(), errmsg(), get_tablespace_oid(), GUC_check_errdetail, InvalidOid, IsTransactionState(), MyDatabaseId, newval, NOTICE, OidIsValid, PGC_S_TEST, and source.

◆ check_default_text_search_config()

bool check_default_text_search_config ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 602 of file ts_cache.c.

603 {
604  /*
605  * If we aren't inside a transaction, or connected to a database, we
606  * cannot do the catalog accesses necessary to verify the config name.
607  * Must accept it on faith.
608  */
610  {
611  ErrorSaveContext escontext = {T_ErrorSaveContext};
612  List *namelist;
613  Oid cfgId;
614  HeapTuple tuple;
615  Form_pg_ts_config cfg;
616  char *buf;
617 
618  namelist = stringToQualifiedNameList(*newval,
619  (Node *) &escontext);
620  if (namelist != NIL)
621  cfgId = get_ts_config_oid(namelist, true);
622  else
623  cfgId = InvalidOid; /* bad name list syntax */
624 
625  /*
626  * When source == PGC_S_TEST, don't throw a hard error for a
627  * nonexistent configuration, only a NOTICE. See comments in guc.h.
628  */
629  if (!OidIsValid(cfgId))
630  {
631  if (source == PGC_S_TEST)
632  {
633  ereport(NOTICE,
634  (errcode(ERRCODE_UNDEFINED_OBJECT),
635  errmsg("text search configuration \"%s\" does not exist", *newval)));
636  return true;
637  }
638  else
639  return false;
640  }
641 
642  /*
643  * Modify the actually stored value to be fully qualified, to ensure
644  * later changes of search_path don't affect it.
645  */
646  tuple = SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(cfgId));
647  if (!HeapTupleIsValid(tuple))
648  elog(ERROR, "cache lookup failed for text search configuration %u",
649  cfgId);
650  cfg = (Form_pg_ts_config) GETSTRUCT(tuple);
651 
653  NameStr(cfg->cfgname));
654 
655  ReleaseSysCache(tuple);
656 
657  /* GUC wants it guc_malloc'd not palloc'd */
658  guc_free(*newval);
659  *newval = guc_strdup(LOG, buf);
660  pfree(buf);
661  if (!*newval)
662  return false;
663  }
664 
665  return true;
666 }
#define NameStr(name)
Definition: c.h:700
#define HeapTupleIsValid(tuple)
Definition: htup.h:78
#define GETSTRUCT(TUP)
Definition: htup_details.h:653
char * get_namespace_name(Oid nspid)
Definition: lsyscache.c:3366
Oid get_ts_config_oid(List *names, bool missing_ok)
Definition: namespace.c:3152
#define NIL
Definition: pg_list.h:68
static char * buf
Definition: pg_test_fsync.c:72
FormData_pg_ts_config * Form_pg_ts_config
Definition: pg_ts_config.h:48
static Datum ObjectIdGetDatum(Oid X)
Definition: postgres.h:252
unsigned int Oid
Definition: postgres_ext.h:31
List * stringToQualifiedNameList(const char *string, Node *escontext)
Definition: regproc.c:1797
char * quote_qualified_identifier(const char *qualifier, const char *ident)
Definition: ruleutils.c:12952
Definition: nodes.h:129
void ReleaseSysCache(HeapTuple tuple)
Definition: syscache.c:269
HeapTuple SearchSysCache1(int cacheId, Datum key1)
Definition: syscache.c:221

References buf, elog, ereport, errcode(), errmsg(), ERROR, get_namespace_name(), get_ts_config_oid(), GETSTRUCT, guc_free(), guc_strdup(), HeapTupleIsValid, InvalidOid, IsTransactionState(), LOG, MyDatabaseId, NameStr, newval, NIL, NOTICE, ObjectIdGetDatum(), OidIsValid, pfree(), PGC_S_TEST, quote_qualified_identifier(), ReleaseSysCache(), SearchSysCache1(), source, and stringToQualifiedNameList().

◆ check_default_with_oids()

bool check_default_with_oids ( bool *  newval,
void **  extra,
GucSource  source 
)

Definition at line 1214 of file variable.c.

1215 {
1216  if (*newval)
1217  {
1218  /* check the GUC's definition for an explanation */
1219  GUC_check_errcode(ERRCODE_FEATURE_NOT_SUPPORTED);
1220  GUC_check_errmsg("tables declared WITH OIDS are not supported");
1221 
1222  return false;
1223  }
1224 
1225  return true;
1226 }

References GUC_check_errcode(), GUC_check_errmsg, and newval.

◆ check_effective_io_concurrency()

bool check_effective_io_concurrency ( int *  newval,
void **  extra,
GucSource  source 
)

Definition at line 1229 of file variable.c.

1230 {
1231 #ifndef USE_PREFETCH
1232  if (*newval != 0)
1233  {
1234  GUC_check_errdetail("\"%s\" must be set to 0 on platforms that lack support for issuing read-ahead advice.",
1235  "effective_io_concurrency");
1236  return false;
1237  }
1238 #endif /* USE_PREFETCH */
1239  return true;
1240 }

References GUC_check_errdetail, and newval.

◆ check_huge_page_size()

bool check_huge_page_size ( int *  newval,
void **  extra,
GucSource  source 
)

Definition at line 578 of file sysv_shmem.c.

579 {
580 #if !(defined(MAP_HUGE_MASK) && defined(MAP_HUGE_SHIFT))
581  /* Recent enough Linux only, for now. See GetHugePageSize(). */
582  if (*newval != 0)
583  {
584  GUC_check_errdetail("\"huge_page_size\" must be 0 on this platform.");
585  return false;
586  }
587 #endif
588  return true;
589 }

References GUC_check_errdetail, and newval.

◆ check_locale_messages()

bool check_locale_messages ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 416 of file pg_locale.c.

417 {
418  if (**newval == '\0')
419  {
420  if (source == PGC_S_DEFAULT)
421  return true;
422  else
423  return false;
424  }
425 
426  /*
427  * LC_MESSAGES category does not exist everywhere, but accept it anyway
428  *
429  * On Windows, we can't even check the value, so accept blindly
430  */
431 #if defined(LC_MESSAGES) && !defined(WIN32)
432  return check_locale(LC_MESSAGES, *newval, NULL);
433 #else
434  return true;
435 #endif
436 }
@ PGC_S_DEFAULT
Definition: guc.h:109
bool check_locale(int category, const char *locale, char **canonname)
Definition: pg_locale.c:305

References check_locale(), newval, PGC_S_DEFAULT, and source.

◆ check_locale_monetary()

bool check_locale_monetary ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 370 of file pg_locale.c.

371 {
372  return check_locale(LC_MONETARY, *newval, NULL);
373 }

References check_locale(), and newval.

◆ check_locale_numeric()

bool check_locale_numeric ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 382 of file pg_locale.c.

383 {
384  return check_locale(LC_NUMERIC, *newval, NULL);
385 }

References check_locale(), and newval.

◆ check_locale_time()

bool check_locale_time ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 394 of file pg_locale.c.

395 {
396  return check_locale(LC_TIME, *newval, NULL);
397 }

References check_locale(), and newval.

◆ check_log_destination()

bool check_log_destination ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 2235 of file elog.c.

2236 {
2237  char *rawstring;
2238  List *elemlist;
2239  ListCell *l;
2240  int newlogdest = 0;
2241  int *myextra;
2242 
2243  /* Need a modifiable copy of string */
2244  rawstring = pstrdup(*newval);
2245 
2246  /* Parse string into list of identifiers */
2247  if (!SplitIdentifierString(rawstring, ',', &elemlist))
2248  {
2249  /* syntax error in list */
2250  GUC_check_errdetail("List syntax is invalid.");
2251  pfree(rawstring);
2252  list_free(elemlist);
2253  return false;
2254  }
2255 
2256  foreach(l, elemlist)
2257  {
2258  char *tok = (char *) lfirst(l);
2259 
2260  if (pg_strcasecmp(tok, "stderr") == 0)
2261  newlogdest |= LOG_DESTINATION_STDERR;
2262  else if (pg_strcasecmp(tok, "csvlog") == 0)
2263  newlogdest |= LOG_DESTINATION_CSVLOG;
2264  else if (pg_strcasecmp(tok, "jsonlog") == 0)
2265  newlogdest |= LOG_DESTINATION_JSONLOG;
2266 #ifdef HAVE_SYSLOG
2267  else if (pg_strcasecmp(tok, "syslog") == 0)
2268  newlogdest |= LOG_DESTINATION_SYSLOG;
2269 #endif
2270 #ifdef WIN32
2271  else if (pg_strcasecmp(tok, "eventlog") == 0)
2272  newlogdest |= LOG_DESTINATION_EVENTLOG;
2273 #endif
2274  else
2275  {
2276  GUC_check_errdetail("Unrecognized key word: \"%s\".", tok);
2277  pfree(rawstring);
2278  list_free(elemlist);
2279  return false;
2280  }
2281  }
2282 
2283  pfree(rawstring);
2284  list_free(elemlist);
2285 
2286  myextra = (int *) guc_malloc(ERROR, sizeof(int));
2287  *myextra = newlogdest;
2288  *extra = myextra;
2289 
2290  return true;
2291 }
#define LOG_DESTINATION_JSONLOG
Definition: elog.h:497
#define LOG_DESTINATION_SYSLOG
Definition: elog.h:494
#define LOG_DESTINATION_STDERR
Definition: elog.h:493
#define LOG_DESTINATION_EVENTLOG
Definition: elog.h:495
#define LOG_DESTINATION_CSVLOG
Definition: elog.h:496

References ERROR, GUC_check_errdetail, guc_malloc(), lfirst, list_free(), LOG_DESTINATION_CSVLOG, LOG_DESTINATION_EVENTLOG, LOG_DESTINATION_JSONLOG, LOG_DESTINATION_STDERR, LOG_DESTINATION_SYSLOG, newval, pfree(), pg_strcasecmp(), pstrdup(), and SplitIdentifierString().

◆ check_log_stats()

bool check_log_stats ( bool *  newval,
void **  extra,
GucSource  source 
)

Definition at line 3684 of file postgres.c.

3685 {
3686  if (*newval &&
3688  {
3689  GUC_check_errdetail("Cannot enable \"log_statement_stats\" when "
3690  "\"log_parser_stats\", \"log_planner_stats\", "
3691  "or \"log_executor_stats\" is true.");
3692  return false;
3693  }
3694  return true;
3695 }
bool log_parser_stats
Definition: guc_tables.c:502
bool log_planner_stats
Definition: guc_tables.c:503
bool log_executor_stats
Definition: guc_tables.c:504

References GUC_check_errdetail, log_executor_stats, log_parser_stats, log_planner_stats, and newval.

◆ check_log_timezone()

bool check_log_timezone ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 416 of file variable.c.

417 {
418  pg_tz *new_tz;
419 
420  /*
421  * Assume it is a timezone name, and try to load it.
422  */
423  new_tz = pg_tzset(*newval);
424 
425  if (!new_tz)
426  {
427  /* Doesn't seem to be any great value in errdetail here */
428  return false;
429  }
430 
431  if (!pg_tz_acceptable(new_tz))
432  {
433  GUC_check_errmsg("time zone \"%s\" appears to use leap seconds",
434  *newval);
435  GUC_check_errdetail("PostgreSQL does not support leap seconds.");
436  return false;
437  }
438 
439  /*
440  * Pass back data for assign_log_timezone to use
441  */
442  *extra = guc_malloc(LOG, sizeof(pg_tz *));
443  if (!*extra)
444  return false;
445  *((pg_tz **) *extra) = new_tz;
446 
447  return true;
448 }
bool pg_tz_acceptable(pg_tz *tz)
Definition: localtime.c:1890
pg_tz * pg_tzset(const char *tzname)
Definition: pgtz.c:234

References GUC_check_errdetail, GUC_check_errmsg, guc_malloc(), LOG, newval, pg_tz_acceptable(), and pg_tzset().

◆ check_maintenance_io_concurrency()

bool check_maintenance_io_concurrency ( int *  newval,
void **  extra,
GucSource  source 
)

Definition at line 1243 of file variable.c.

1244 {
1245 #ifndef USE_PREFETCH
1246  if (*newval != 0)
1247  {
1248  GUC_check_errdetail("\"%s\" must be set to 0 on platforms that lack support for issuing read-ahead advice.",
1249  "maintenance_io_concurrency");
1250  return false;
1251  }
1252 #endif /* USE_PREFETCH */
1253  return true;
1254 }

References GUC_check_errdetail, and newval.

◆ check_max_slot_wal_keep_size()

bool check_max_slot_wal_keep_size ( int *  newval,
void **  extra,
GucSource  source 
)

Definition at line 2223 of file xlog.c.

2224 {
2225  if (IsBinaryUpgrade && *newval != -1)
2226  {
2227  GUC_check_errdetail("\"%s\" must be set to -1 during binary upgrade mode.",
2228  "max_slot_wal_keep_size");
2229  return false;
2230  }
2231 
2232  return true;
2233 }
bool IsBinaryUpgrade
Definition: globals.c:120

References GUC_check_errdetail, IsBinaryUpgrade, and newval.

◆ check_max_stack_depth()

bool check_max_stack_depth ( int *  newval,
void **  extra,
GucSource  source 
)

Definition at line 3621 of file postgres.c.

3622 {
3623  long newval_bytes = *newval * 1024L;
3624  long stack_rlimit = get_stack_depth_rlimit();
3625 
3626  if (stack_rlimit > 0 && newval_bytes > stack_rlimit - STACK_DEPTH_SLOP)
3627  {
3628  GUC_check_errdetail("\"max_stack_depth\" must not exceed %ldkB.",
3629  (stack_rlimit - STACK_DEPTH_SLOP) / 1024L);
3630  GUC_check_errhint("Increase the platform's stack depth limit via \"ulimit -s\" or local equivalent.");
3631  return false;
3632  }
3633  return true;
3634 }
#define GUC_check_errhint
Definition: guc.h:480
long get_stack_depth_rlimit(void)
Definition: postgres.c:5110
#define STACK_DEPTH_SLOP
Definition: tcopprot.h:25

References get_stack_depth_rlimit(), GUC_check_errdetail, GUC_check_errhint, newval, and STACK_DEPTH_SLOP.

◆ check_multixact_member_buffers()

bool check_multixact_member_buffers ( int *  newval,
void **  extra,
GucSource  source 
)

Definition at line 2023 of file multixact.c.

2024 {
2025  return check_slru_buffers("multixact_member_buffers", newval);
2026 }

References check_slru_buffers(), and newval.

◆ check_multixact_offset_buffers()

bool check_multixact_offset_buffers ( int *  newval,
void **  extra,
GucSource  source 
)

Definition at line 2014 of file multixact.c.

2015 {
2016  return check_slru_buffers("multixact_offset_buffers", newval);
2017 }

References check_slru_buffers(), and newval.

◆ check_notify_buffers()

bool check_notify_buffers ( int *  newval,
void **  extra,
GucSource  source 
)

Definition at line 2394 of file async.c.

2395 {
2396  return check_slru_buffers("notify_buffers", newval);
2397 }

References check_slru_buffers(), and newval.

◆ check_primary_slot_name()

bool check_primary_slot_name ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 4739 of file xlogrecovery.c.

4740 {
4741  if (*newval && strcmp(*newval, "") != 0 &&
4743  return false;
4744 
4745  return true;
4746 }
bool ReplicationSlotValidateName(const char *name, int elevel)
Definition: slot.c:252

References newval, ReplicationSlotValidateName(), and WARNING.

◆ check_random_seed()

bool check_random_seed ( double *  newval,
void **  extra,
GucSource  source 
)

Definition at line 654 of file variable.c.

655 {
656  *extra = guc_malloc(LOG, sizeof(int));
657  if (!*extra)
658  return false;
659  /* Arm the assign only if source of value is an interactive SET */
660  *((int *) *extra) = (source >= PGC_S_INTERACTIVE);
661 
662  return true;
663 }
@ PGC_S_INTERACTIVE
Definition: guc.h:120

References guc_malloc(), LOG, PGC_S_INTERACTIVE, and source.

◆ check_recovery_prefetch()

bool check_recovery_prefetch ( int *  new_value,
void **  extra,
GucSource  source 
)

Definition at line 1081 of file xlogprefetcher.c.

1082 {
1083 #ifndef USE_PREFETCH
1084  if (*new_value == RECOVERY_PREFETCH_ON)
1085  {
1086  GUC_check_errdetail("\"recovery_prefetch\" is not supported on platforms that lack support for issuing read-ahead advice.");
1087  return false;
1088  }
1089 #endif
1090 
1091  return true;
1092 }
@ RECOVERY_PREFETCH_ON

References GUC_check_errdetail, and RECOVERY_PREFETCH_ON.

◆ check_recovery_target()

bool check_recovery_target ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 4780 of file xlogrecovery.c.

4781 {
4782  if (strcmp(*newval, "immediate") != 0 && strcmp(*newval, "") != 0)
4783  {
4784  GUC_check_errdetail("The only allowed value is \"immediate\".");
4785  return false;
4786  }
4787  return true;
4788 }

References GUC_check_errdetail, and newval.

◆ check_recovery_target_lsn()

bool check_recovery_target_lsn ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 4810 of file xlogrecovery.c.

4811 {
4812  if (strcmp(*newval, "") != 0)
4813  {
4814  XLogRecPtr lsn;
4815  XLogRecPtr *myextra;
4816  bool have_error = false;
4817 
4818  lsn = pg_lsn_in_internal(*newval, &have_error);
4819  if (have_error)
4820  return false;
4821 
4822  myextra = (XLogRecPtr *) guc_malloc(ERROR, sizeof(XLogRecPtr));
4823  *myextra = lsn;
4824  *extra = myextra;
4825  }
4826  return true;
4827 }
XLogRecPtr pg_lsn_in_internal(const char *str, bool *have_error)
Definition: pg_lsn.c:29

References ERROR, guc_malloc(), newval, and pg_lsn_in_internal().

◆ check_recovery_target_name()

bool check_recovery_target_name ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 4852 of file xlogrecovery.c.

4853 {
4854  /* Use the value of newval directly */
4855  if (strlen(*newval) >= MAXFNAMELEN)
4856  {
4857  GUC_check_errdetail("\"%s\" is too long (maximum %d characters).",
4858  "recovery_target_name", MAXFNAMELEN - 1);
4859  return false;
4860  }
4861  return true;
4862 }

References GUC_check_errdetail, MAXFNAMELEN, and newval.

◆ check_recovery_target_time()

bool check_recovery_target_time ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 4893 of file xlogrecovery.c.

4894 {
4895  if (strcmp(*newval, "") != 0)
4896  {
4897  /* reject some special values */
4898  if (strcmp(*newval, "now") == 0 ||
4899  strcmp(*newval, "today") == 0 ||
4900  strcmp(*newval, "tomorrow") == 0 ||
4901  strcmp(*newval, "yesterday") == 0)
4902  {
4903  return false;
4904  }
4905 
4906  /*
4907  * parse timestamp value (see also timestamptz_in())
4908  */
4909  {
4910  char *str = *newval;
4911  fsec_t fsec;
4912  struct pg_tm tt,
4913  *tm = &tt;
4914  int tz;
4915  int dtype;
4916  int nf;
4917  int dterr;
4918  char *field[MAXDATEFIELDS];
4919  int ftype[MAXDATEFIELDS];
4920  char workbuf[MAXDATELEN + MAXDATEFIELDS];
4921  DateTimeErrorExtra dtextra;
4923 
4924  dterr = ParseDateTime(str, workbuf, sizeof(workbuf),
4925  field, ftype, MAXDATEFIELDS, &nf);
4926  if (dterr == 0)
4927  dterr = DecodeDateTime(field, ftype, nf,
4928  &dtype, tm, &fsec, &tz, &dtextra);
4929  if (dterr != 0)
4930  return false;
4931  if (dtype != DTK_DATE)
4932  return false;
4933 
4934  if (tm2timestamp(tm, fsec, &tz, &timestamp) != 0)
4935  {
4936  GUC_check_errdetail("Timestamp out of range: \"%s\".", str);
4937  return false;
4938  }
4939  }
4940  }
4941  return true;
4942 }
int ParseDateTime(const char *timestr, char *workbuf, size_t buflen, char **field, int *ftype, int maxfields, int *numfields)
Definition: datetime.c:754
int DecodeDateTime(char **field, int *ftype, int nf, int *dtype, struct pg_tm *tm, fsec_t *fsec, int *tzp, DateTimeErrorExtra *extra)
Definition: datetime.c:978
int tm2timestamp(struct pg_tm *tm, fsec_t fsec, int *tzp, Timestamp *result)
Definition: timestamp.c:1987
int64 TimestampTz
Definition: timestamp.h:39
int32 fsec_t
Definition: timestamp.h:41
const char * str
#define MAXDATEFIELDS
Definition: datetime.h:202
#define DTK_DATE
Definition: datetime.h:144
#define MAXDATELEN
Definition: datetime.h:200
static struct pg_tm tm
Definition: localtime.c:104
int64 timestamp
Definition: pgtime.h:35

References DecodeDateTime(), DTK_DATE, GUC_check_errdetail, MAXDATEFIELDS, MAXDATELEN, newval, ParseDateTime(), str, tm, and tm2timestamp().

◆ check_recovery_target_timeline()

bool check_recovery_target_timeline ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 4964 of file xlogrecovery.c.

4965 {
4967  RecoveryTargetTimeLineGoal *myextra;
4968 
4969  if (strcmp(*newval, "current") == 0)
4971  else if (strcmp(*newval, "latest") == 0)
4973  else
4974  {
4976 
4977  errno = 0;
4978  strtoul(*newval, NULL, 0);
4979  if (errno == EINVAL || errno == ERANGE)
4980  {
4981  GUC_check_errdetail("\"recovery_target_timeline\" is not a valid number.");
4982  return false;
4983  }
4984  }
4985 
4987  *myextra = rttg;
4988  *extra = myextra;
4989 
4990  return true;
4991 }
@ RECOVERY_TARGET_TIMELINE_CONTROLFILE
Definition: xlogrecovery.h:38
@ RECOVERY_TARGET_TIMELINE_LATEST
Definition: xlogrecovery.h:39

References ERROR, GUC_check_errdetail, guc_malloc(), newval, RECOVERY_TARGET_TIMELINE_CONTROLFILE, RECOVERY_TARGET_TIMELINE_LATEST, and RECOVERY_TARGET_TIMELINE_NUMERIC.

◆ check_recovery_target_xid()

bool check_recovery_target_xid ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 5010 of file xlogrecovery.c.

5011 {
5012  if (strcmp(*newval, "") != 0)
5013  {
5014  TransactionId xid;
5015  TransactionId *myextra;
5016 
5017  errno = 0;
5018  xid = (TransactionId) strtou64(*newval, NULL, 0);
5019  if (errno == EINVAL || errno == ERANGE)
5020  return false;
5021 
5022  myextra = (TransactionId *) guc_malloc(ERROR, sizeof(TransactionId));
5023  *myextra = xid;
5024  *extra = myextra;
5025  }
5026  return true;
5027 }

References ERROR, guc_malloc(), and newval.

◆ check_restrict_nonsystem_relation_kind()

bool check_restrict_nonsystem_relation_kind ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 3718 of file postgres.c.

3719 {
3720  char *rawstring;
3721  List *elemlist;
3722  ListCell *l;
3723  int flags = 0;
3724 
3725  /* Need a modifiable copy of string */
3726  rawstring = pstrdup(*newval);
3727 
3728  if (!SplitIdentifierString(rawstring, ',', &elemlist))
3729  {
3730  /* syntax error in list */
3731  GUC_check_errdetail("List syntax is invalid.");
3732  pfree(rawstring);
3733  list_free(elemlist);
3734  return false;
3735  }
3736 
3737  foreach(l, elemlist)
3738  {
3739  char *tok = (char *) lfirst(l);
3740 
3741  if (pg_strcasecmp(tok, "view") == 0)
3742  flags |= RESTRICT_RELKIND_VIEW;
3743  else if (pg_strcasecmp(tok, "foreign-table") == 0)
3745  else
3746  {
3747  GUC_check_errdetail("Unrecognized key word: \"%s\".", tok);
3748  pfree(rawstring);
3749  list_free(elemlist);
3750  return false;
3751  }
3752  }
3753 
3754  pfree(rawstring);
3755  list_free(elemlist);
3756 
3757  /* Save the flags in *extra, for use by the assign function */
3758  *extra = guc_malloc(ERROR, sizeof(int));
3759  *((int *) *extra) = flags;
3760 
3761  return true;
3762 }
#define RESTRICT_RELKIND_FOREIGN_TABLE
Definition: tcopprot.h:48
#define RESTRICT_RELKIND_VIEW
Definition: tcopprot.h:47

References ERROR, GUC_check_errdetail, guc_malloc(), lfirst, list_free(), newval, pfree(), pg_strcasecmp(), pstrdup(), RESTRICT_RELKIND_FOREIGN_TABLE, RESTRICT_RELKIND_VIEW, and SplitIdentifierString().

◆ check_role()

bool check_role ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 931 of file variable.c.

932 {
933  HeapTuple roleTup;
934  Oid roleid;
935  bool is_superuser;
936  role_auth_extra *myextra;
937  Form_pg_authid roleform;
938 
939  if (strcmp(*newval, "none") == 0)
940  {
941  /* hardwired translation */
942  roleid = InvalidOid;
943  is_superuser = false;
944  }
946  {
947  /*
948  * In parallel worker initialization, we want to copy the leader's
949  * state even if it no longer matches the catalogs. ParallelWorkerMain
950  * already installed the correct role OID and superuser state.
951  */
952  roleid = GetCurrentRoleId();
954  }
955  else
956  {
957  if (!IsTransactionState())
958  {
959  /*
960  * Can't do catalog lookups, so fail. The result of this is that
961  * role cannot be set in postgresql.conf, which seems like a good
962  * thing anyway, so we don't work hard to avoid it.
963  */
964  return false;
965  }
966 
967  /*
968  * When source == PGC_S_TEST, we don't throw a hard error for a
969  * nonexistent user name or insufficient privileges, only a NOTICE.
970  * See comments in guc.h.
971  */
972 
973  /* Look up the username */
974  roleTup = SearchSysCache1(AUTHNAME, PointerGetDatum(*newval));
975  if (!HeapTupleIsValid(roleTup))
976  {
977  if (source == PGC_S_TEST)
978  {
979  ereport(NOTICE,
980  (errcode(ERRCODE_UNDEFINED_OBJECT),
981  errmsg("role \"%s\" does not exist", *newval)));
982  return true;
983  }
984  GUC_check_errmsg("role \"%s\" does not exist", *newval);
985  return false;
986  }
987 
988  roleform = (Form_pg_authid) GETSTRUCT(roleTup);
989  roleid = roleform->oid;
990  is_superuser = roleform->rolsuper;
991 
992  ReleaseSysCache(roleTup);
993 
994  /* Verify that session user is allowed to become this role */
995  if (!member_can_set_role(GetSessionUserId(), roleid))
996  {
997  if (source == PGC_S_TEST)
998  {
999  ereport(NOTICE,
1000  (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
1001  errmsg("permission will be denied to set role \"%s\"",
1002  *newval)));
1003  return true;
1004  }
1005  GUC_check_errcode(ERRCODE_INSUFFICIENT_PRIVILEGE);
1006  GUC_check_errmsg("permission denied to set role \"%s\"",
1007  *newval);
1008  return false;
1009  }
1010  }
1011 
1012  /* Set up "extra" struct for assign_role to use */
1013  myextra = (role_auth_extra *) guc_malloc(LOG, sizeof(role_auth_extra));
1014  if (!myextra)
1015  return false;
1016  myextra->roleid = roleid;
1017  myextra->is_superuser = is_superuser;
1018  *extra = myextra;
1019 
1020  return true;
1021 }
bool member_can_set_role(Oid member, Oid role)
Definition: acl.c:5302
bool current_role_is_superuser
Definition: guc_tables.c:519
Oid GetSessionUserId(void)
Definition: miscinit.c:563
Oid GetCurrentRoleId(void)
Definition: miscinit.c:988
FormData_pg_authid * Form_pg_authid
Definition: pg_authid.h:56
static bool is_superuser(Archive *fout)
Definition: pg_dump.c:4806
static Datum PointerGetDatum(const void *X)
Definition: postgres.h:322

References current_role_is_superuser, ereport, errcode(), errmsg(), GetCurrentRoleId(), GetSessionUserId(), GETSTRUCT, GUC_check_errcode(), GUC_check_errmsg, guc_malloc(), HeapTupleIsValid, InitializingParallelWorker, InvalidOid, role_auth_extra::is_superuser, is_superuser(), IsTransactionState(), LOG, member_can_set_role(), newval, NOTICE, PGC_S_TEST, PointerGetDatum(), ReleaseSysCache(), role_auth_extra::roleid, SearchSysCache1(), and source.

◆ check_search_path()

bool check_search_path ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 4657 of file namespace.c.

4658 {
4659  Oid roleid = InvalidOid;
4660  const char *searchPath = *newval;
4661  char *rawname;
4662  List *namelist;
4663  bool use_cache = (SearchPathCacheContext != NULL);
4664 
4665  /*
4666  * We used to try to check that the named schemas exist, but there are
4667  * many valid use-cases for having search_path settings that include
4668  * schemas that don't exist; and often, we are not inside a transaction
4669  * here and so can't consult the system catalogs anyway. So now, the only
4670  * requirement is syntactic validity of the identifier list.
4671  *
4672  * Checking only the syntactic validity also allows us to use the search
4673  * path cache (if available) to avoid calling SplitIdentifierString() on
4674  * the same string repeatedly.
4675  */
4676  if (use_cache)
4677  {
4678  spcache_init();
4679 
4680  roleid = GetUserId();
4681 
4682  if (spcache_lookup(searchPath, roleid) != NULL)
4683  return true;
4684  }
4685 
4686  /*
4687  * Ensure validity check succeeds before creating cache entry.
4688  */
4689 
4690  rawname = pstrdup(searchPath); /* need a modifiable copy */
4691 
4692  /* Parse string into list of identifiers */
4693  if (!SplitIdentifierString(rawname, ',', &namelist))
4694  {
4695  /* syntax error in name list */
4696  GUC_check_errdetail("List syntax is invalid.");
4697  pfree(rawname);
4698  list_free(namelist);
4699  return false;
4700  }
4701  pfree(rawname);
4702  list_free(namelist);
4703 
4704  /* OK to create empty cache entry */
4705  if (use_cache)
4706  (void) spcache_insert(searchPath, roleid);
4707 
4708  return true;
4709 }
Oid GetUserId(void)
Definition: miscinit.c:524
static MemoryContext SearchPathCacheContext
Definition: namespace.c:165
static SearchPathCacheEntry * spcache_lookup(const char *searchPath, Oid roleid)
Definition: namespace.c:344
static void spcache_init(void)
Definition: namespace.c:306
static SearchPathCacheEntry * spcache_insert(const char *searchPath, Oid roleid)
Definition: namespace.c:374

References GetUserId(), GUC_check_errdetail, InvalidOid, list_free(), newval, pfree(), pstrdup(), SearchPathCacheContext, spcache_init(), spcache_insert(), spcache_lookup(), and SplitIdentifierString().

◆ check_serial_buffers()

bool check_serial_buffers ( int *  newval,
void **  extra,
GucSource  source 
)

Definition at line 847 of file predicate.c.

848 {
849  return check_slru_buffers("serializable_buffers", newval);
850 }

References check_slru_buffers(), and newval.

◆ check_session_authorization()

bool check_session_authorization ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 813 of file variable.c.

814 {
815  HeapTuple roleTup;
816  Form_pg_authid roleform;
817  Oid roleid;
818  bool is_superuser;
819  role_auth_extra *myextra;
820 
821  /* Do nothing for the boot_val default of NULL */
822  if (*newval == NULL)
823  return true;
824 
826  {
827  /*
828  * In parallel worker initialization, we want to copy the leader's
829  * state even if it no longer matches the catalogs. ParallelWorkerMain
830  * already installed the correct role OID and superuser state.
831  */
832  roleid = GetSessionUserId();
834  }
835  else
836  {
837  if (!IsTransactionState())
838  {
839  /*
840  * Can't do catalog lookups, so fail. The result of this is that
841  * session_authorization cannot be set in postgresql.conf, which
842  * seems like a good thing anyway, so we don't work hard to avoid
843  * it.
844  */
845  return false;
846  }
847 
848  /*
849  * When source == PGC_S_TEST, we don't throw a hard error for a
850  * nonexistent user name or insufficient privileges, only a NOTICE.
851  * See comments in guc.h.
852  */
853 
854  /* Look up the username */
855  roleTup = SearchSysCache1(AUTHNAME, PointerGetDatum(*newval));
856  if (!HeapTupleIsValid(roleTup))
857  {
858  if (source == PGC_S_TEST)
859  {
860  ereport(NOTICE,
861  (errcode(ERRCODE_UNDEFINED_OBJECT),
862  errmsg("role \"%s\" does not exist", *newval)));
863  return true;
864  }
865  GUC_check_errmsg("role \"%s\" does not exist", *newval);
866  return false;
867  }
868 
869  roleform = (Form_pg_authid) GETSTRUCT(roleTup);
870  roleid = roleform->oid;
871  is_superuser = roleform->rolsuper;
872 
873  ReleaseSysCache(roleTup);
874 
875  /*
876  * Only superusers may SET SESSION AUTHORIZATION a role other than
877  * itself. Note that in case of multiple SETs in a single session, the
878  * original authenticated user's superuserness is what matters.
879  */
880  if (roleid != GetAuthenticatedUserId() &&
882  {
883  if (source == PGC_S_TEST)
884  {
885  ereport(NOTICE,
886  (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
887  errmsg("permission will be denied to set session authorization \"%s\"",
888  *newval)));
889  return true;
890  }
891  GUC_check_errcode(ERRCODE_INSUFFICIENT_PRIVILEGE);
892  GUC_check_errmsg("permission denied to set session authorization \"%s\"",
893  *newval);
894  return false;
895  }
896  }
897 
898  /* Set up "extra" struct for assign_session_authorization to use */
899  myextra = (role_auth_extra *) guc_malloc(LOG, sizeof(role_auth_extra));
900  if (!myextra)
901  return false;
902  myextra->roleid = roleid;
903  myextra->is_superuser = is_superuser;
904  *extra = myextra;
905 
906  return true;
907 }
bool GetSessionUserIsSuperuser(void)
Definition: miscinit.c:570
Oid GetAuthenticatedUserId(void)
Definition: miscinit.c:600
bool superuser_arg(Oid roleid)
Definition: superuser.c:56

References ereport, errcode(), errmsg(), GetAuthenticatedUserId(), GetSessionUserId(), GetSessionUserIsSuperuser(), GETSTRUCT, GUC_check_errcode(), GUC_check_errmsg, guc_malloc(), HeapTupleIsValid, InitializingParallelWorker, role_auth_extra::is_superuser, is_superuser(), IsTransactionState(), LOG, newval, NOTICE, PGC_S_TEST, PointerGetDatum(), ReleaseSysCache(), role_auth_extra::roleid, SearchSysCache1(), source, and superuser_arg().

◆ check_ssl()

bool check_ssl ( bool *  newval,
void **  extra,
GucSource  source 
)

Definition at line 1257 of file variable.c.

1258 {
1259 #ifndef USE_SSL
1260  if (*newval)
1261  {
1262  GUC_check_errmsg("SSL is not supported by this build");
1263  return false;
1264  }
1265 #endif
1266  return true;
1267 }

References GUC_check_errmsg, and newval.

◆ check_stage_log_stats()

bool check_stage_log_stats ( bool *  newval,
void **  extra,
GucSource  source 
)

Definition at line 3670 of file postgres.c.

3671 {
3672  if (*newval && log_statement_stats)
3673  {
3674  GUC_check_errdetail("Cannot enable parameter when \"log_statement_stats\" is true.");
3675  return false;
3676  }
3677  return true;
3678 }
bool log_statement_stats
Definition: guc_tables.c:505

References GUC_check_errdetail, log_statement_stats, and newval.

◆ check_subtrans_buffers()

bool check_subtrans_buffers ( int *  newval,
void **  extra,
GucSource  source 
)

Definition at line 254 of file subtrans.c.

255 {
256  return check_slru_buffers("subtransaction_buffers", newval);
257 }

References check_slru_buffers(), and newval.

◆ check_synchronized_standby_slots()

bool check_synchronized_standby_slots ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 2503 of file slot.c.

2504 {
2505  char *rawname;
2506  char *ptr;
2507  List *elemlist;
2508  int size;
2509  bool ok;
2511 
2512  if ((*newval)[0] == '\0')
2513  return true;
2514 
2515  /* Need a modifiable copy of the GUC string */
2516  rawname = pstrdup(*newval);
2517 
2518  /* Now verify if the specified slots exist and have correct type */
2519  ok = validate_sync_standby_slots(rawname, &elemlist);
2520 
2521  if (!ok || elemlist == NIL)
2522  {
2523  pfree(rawname);
2524  list_free(elemlist);
2525  return ok;
2526  }
2527 
2528  /* Compute the size required for the SyncStandbySlotsConfigData struct */
2529  size = offsetof(SyncStandbySlotsConfigData, slot_names);
2530  foreach_ptr(char, slot_name, elemlist)
2531  size += strlen(slot_name) + 1;
2532 
2533  /* GUC extra value must be guc_malloc'd, not palloc'd */
2535 
2536  /* Transform the data into SyncStandbySlotsConfigData */
2537  config->nslotnames = list_length(elemlist);
2538 
2539  ptr = config->slot_names;
2540  foreach_ptr(char, slot_name, elemlist)
2541  {
2542  strcpy(ptr, slot_name);
2543  ptr += strlen(slot_name) + 1;
2544  }
2545 
2546  *extra = config;
2547 
2548  pfree(rawname);
2549  list_free(elemlist);
2550  return true;
2551 }
static int list_length(const List *l)
Definition: pg_list.h:152
#define foreach_ptr(type, var, lst)
Definition: pg_list.h:469
static pg_noinline void Size size
Definition: slab.c:607
static bool validate_sync_standby_slots(char *rawname, List **elemlist)
Definition: slot.c:2448
char slot_names[FLEXIBLE_ARRAY_MEMBER]
Definition: slot.c:99

References foreach_ptr, guc_malloc(), list_free(), list_length(), LOG, newval, NIL, SyncStandbySlotsConfigData::nslotnames, pfree(), pstrdup(), size, SyncStandbySlotsConfigData::slot_names, and validate_sync_standby_slots().

◆ check_synchronous_standby_names()

bool check_synchronous_standby_names ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 991 of file syncrep.c.

992 {
993  if (*newval != NULL && (*newval)[0] != '\0')
994  {
995  int parse_rc;
996  SyncRepConfigData *pconf;
997 
998  /* Reset communication variables to ensure a fresh start */
999  syncrep_parse_result = NULL;
1000  syncrep_parse_error_msg = NULL;
1001 
1002  /* Parse the synchronous_standby_names string */
1004  parse_rc = syncrep_yyparse();
1006 
1007  if (parse_rc != 0 || syncrep_parse_result == NULL)
1008  {
1009  GUC_check_errcode(ERRCODE_SYNTAX_ERROR);
1012  else
1013  GUC_check_errdetail("\"%s\" parser failed.",
1014  "synchronous_standby_names");
1015  return false;
1016  }
1017 
1018  if (syncrep_parse_result->num_sync <= 0)
1019  {
1020  GUC_check_errmsg("number of synchronous standbys (%d) must be greater than zero",
1022  return false;
1023  }
1024 
1025  /* GUC extra value must be guc_malloc'd, not palloc'd */
1026  pconf = (SyncRepConfigData *)
1028  if (pconf == NULL)
1029  return false;
1031 
1032  *extra = pconf;
1033 
1034  /*
1035  * We need not explicitly clean up syncrep_parse_result. It, and any
1036  * other cruft generated during parsing, will be freed when the
1037  * current memory context is deleted. (This code is generally run in
1038  * a short-lived context used for config file processing, so that will
1039  * not be very long.)
1040  */
1041  }
1042  else
1043  *extra = NULL;
1044 
1045  return true;
1046 }
void syncrep_scanner_init(const char *str)
void syncrep_scanner_finish(void)
int syncrep_yyparse(void)
PGDLLIMPORT SyncRepConfigData * syncrep_parse_result
PGDLLIMPORT char * syncrep_parse_error_msg

References SyncRepConfigData::config_size, GUC_check_errcode(), GUC_check_errdetail, GUC_check_errmsg, guc_malloc(), LOG, newval, SyncRepConfigData::num_sync, syncrep_parse_error_msg, syncrep_parse_result, syncrep_scanner_finish(), syncrep_scanner_init(), and syncrep_yyparse().

◆ check_temp_buffers()

bool check_temp_buffers ( int *  newval,
void **  extra,
GucSource  source 
)

Definition at line 704 of file localbuf.c.

705 {
706  /*
707  * Once local buffers have been initialized, it's too late to change this.
708  * However, if this is only a test call, allow it.
709  */
710  if (source != PGC_S_TEST && NLocBuffer && NLocBuffer != *newval)
711  {
712  GUC_check_errdetail("\"temp_buffers\" cannot be changed after any temporary tables have been accessed in the session.");
713  return false;
714  }
715  return true;
716 }
int NLocBuffer
Definition: localbuf.c:42

References GUC_check_errdetail, newval, NLocBuffer, PGC_S_TEST, and source.

◆ check_temp_tablespaces()

bool check_temp_tablespaces ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 1198 of file tablespace.c.

1199 {
1200  char *rawname;
1201  List *namelist;
1202 
1203  /* Need a modifiable copy of string */
1204  rawname = pstrdup(*newval);
1205 
1206  /* Parse string into list of identifiers */
1207  if (!SplitIdentifierString(rawname, ',', &namelist))
1208  {
1209  /* syntax error in name list */
1210  GUC_check_errdetail("List syntax is invalid.");
1211  pfree(rawname);
1212  list_free(namelist);
1213  return false;
1214  }
1215 
1216  /*
1217  * If we aren't inside a transaction, or connected to a database, we
1218  * cannot do the catalog accesses necessary to verify the name. Must
1219  * accept the value on faith. Fortunately, there's then also no need to
1220  * pass the data to fd.c.
1221  */
1223  {
1224  temp_tablespaces_extra *myextra;
1225  Oid *tblSpcs;
1226  int numSpcs;
1227  ListCell *l;
1228 
1229  /* temporary workspace until we are done verifying the list */
1230  tblSpcs = (Oid *) palloc(list_length(namelist) * sizeof(Oid));
1231  numSpcs = 0;
1232  foreach(l, namelist)
1233  {
1234  char *curname = (char *) lfirst(l);
1235  Oid curoid;
1236  AclResult aclresult;
1237 
1238  /* Allow an empty string (signifying database default) */
1239  if (curname[0] == '\0')
1240  {
1241  /* InvalidOid signifies database's default tablespace */
1242  tblSpcs[numSpcs++] = InvalidOid;
1243  continue;
1244  }
1245 
1246  /*
1247  * In an interactive SET command, we ereport for bad info. When
1248  * source == PGC_S_TEST, don't throw a hard error for a
1249  * nonexistent tablespace, only a NOTICE. See comments in guc.h.
1250  */
1251  curoid = get_tablespace_oid(curname, source <= PGC_S_TEST);
1252  if (curoid == InvalidOid)
1253  {
1254  if (source == PGC_S_TEST)
1255  ereport(NOTICE,
1256  (errcode(ERRCODE_UNDEFINED_OBJECT),
1257  errmsg("tablespace \"%s\" does not exist",
1258  curname)));
1259  continue;
1260  }
1261 
1262  /*
1263  * Allow explicit specification of database's default tablespace
1264  * in temp_tablespaces without triggering permissions checks.
1265  */
1266  if (curoid == MyDatabaseTableSpace)
1267  {
1268  /* InvalidOid signifies database's default tablespace */
1269  tblSpcs[numSpcs++] = InvalidOid;
1270  continue;
1271  }
1272 
1273  /* Check permissions, similarly complaining only if interactive */
1274  aclresult = object_aclcheck(TableSpaceRelationId, curoid, GetUserId(),
1275  ACL_CREATE);
1276  if (aclresult != ACLCHECK_OK)
1277  {
1278  if (source >= PGC_S_INTERACTIVE)
1279  aclcheck_error(aclresult, OBJECT_TABLESPACE, curname);
1280  continue;
1281  }
1282 
1283  tblSpcs[numSpcs++] = curoid;
1284  }
1285 
1286  /* Now prepare an "extra" struct for assign_temp_tablespaces */
1287  myextra = guc_malloc(LOG, offsetof(temp_tablespaces_extra, tblSpcs) +
1288  numSpcs * sizeof(Oid));
1289  if (!myextra)
1290  return false;
1291  myextra->numSpcs = numSpcs;
1292  memcpy(myextra->tblSpcs, tblSpcs, numSpcs * sizeof(Oid));
1293  *extra = myextra;
1294 
1295  pfree(tblSpcs);
1296  }
1297 
1298  pfree(rawname);
1299  list_free(namelist);
1300 
1301  return true;
1302 }
AclResult
Definition: acl.h:182
@ ACLCHECK_OK
Definition: acl.h:183
void aclcheck_error(AclResult aclerr, ObjectType objtype, const char *objectname)
Definition: aclchk.c:2622
AclResult object_aclcheck(Oid classid, Oid objectid, Oid roleid, AclMode mode)
Definition: aclchk.c:3810
Oid MyDatabaseTableSpace
Definition: globals.c:95
void * palloc(Size size)
Definition: mcxt.c:1317
@ OBJECT_TABLESPACE
Definition: parsenodes.h:2310
#define ACL_CREATE
Definition: parsenodes.h:85

References ACL_CREATE, aclcheck_error(), ACLCHECK_OK, ereport, errcode(), errmsg(), get_tablespace_oid(), GetUserId(), GUC_check_errdetail, guc_malloc(), InvalidOid, IsTransactionState(), lfirst, list_free(), list_length(), LOG, MyDatabaseId, MyDatabaseTableSpace, newval, NOTICE, temp_tablespaces_extra::numSpcs, object_aclcheck(), OBJECT_TABLESPACE, palloc(), pfree(), PGC_S_INTERACTIVE, PGC_S_TEST, pstrdup(), source, SplitIdentifierString(), and temp_tablespaces_extra::tblSpcs.

◆ check_timezone()

bool check_timezone ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 261 of file variable.c.

262 {
263  pg_tz *new_tz;
264  long gmtoffset;
265  char *endptr;
266  double hours;
267 
268  if (pg_strncasecmp(*newval, "interval", 8) == 0)
269  {
270  /*
271  * Support INTERVAL 'foo'. This is for SQL spec compliance, not
272  * because it has any actual real-world usefulness.
273  */
274  const char *valueptr = *newval;
275  char *val;
277 
278  valueptr += 8;
279  while (isspace((unsigned char) *valueptr))
280  valueptr++;
281  if (*valueptr++ != '\'')
282  return false;
283  val = pstrdup(valueptr);
284  /* Check and remove trailing quote */
285  endptr = strchr(val, '\'');
286  if (!endptr || endptr[1] != '\0')
287  {
288  pfree(val);
289  return false;
290  }
291  *endptr = '\0';
292 
293  /*
294  * Try to parse it. XXX an invalid interval format will result in
295  * ereport(ERROR), which is not desirable for GUC. We did what we
296  * could to guard against this in flatten_set_variable_args, but a
297  * string coming in from postgresql.conf might contain anything.
298  */
302  Int32GetDatum(-1)));
303 
304  pfree(val);
305  if (interval->month != 0)
306  {
307  GUC_check_errdetail("Cannot specify months in time zone interval.");
308  pfree(interval);
309  return false;
310  }
311  if (interval->day != 0)
312  {
313  GUC_check_errdetail("Cannot specify days in time zone interval.");
314  pfree(interval);
315  return false;
316  }
317 
318  /* Here we change from SQL to Unix sign convention */
319  gmtoffset = -(interval->time / USECS_PER_SEC);
320  new_tz = pg_tzset_offset(gmtoffset);
321 
322  pfree(interval);
323  }
324  else
325  {
326  /*
327  * Try it as a numeric number of hours (possibly fractional).
328  */
329  hours = strtod(*newval, &endptr);
330  if (endptr != *newval && *endptr == '\0')
331  {
332  /* Here we change from SQL to Unix sign convention */
333  gmtoffset = -hours * SECS_PER_HOUR;
334  new_tz = pg_tzset_offset(gmtoffset);
335  }
336  else
337  {
338  /*
339  * Otherwise assume it is a timezone name, and try to load it.
340  */
341  new_tz = pg_tzset(*newval);
342 
343  if (!new_tz)
344  {
345  /* Doesn't seem to be any great value in errdetail here */
346  return false;
347  }
348 
349  if (!pg_tz_acceptable(new_tz))
350  {
351  GUC_check_errmsg("time zone \"%s\" appears to use leap seconds",
352  *newval);
353  GUC_check_errdetail("PostgreSQL does not support leap seconds.");
354  return false;
355  }
356  }
357  }
358 
359  /* Test for failure in pg_tzset_offset, which we assume is out-of-range */
360  if (!new_tz)
361  {
362  GUC_check_errdetail("UTC timezone offset is out of range.");
363  return false;
364  }
365 
366  /*
367  * Pass back data for assign_timezone to use
368  */
369  *extra = guc_malloc(LOG, sizeof(pg_tz *));
370  if (!*extra)
371  return false;
372  *((pg_tz **) *extra) = new_tz;
373 
374  return true;
375 }
Datum interval_in(PG_FUNCTION_ARGS)
Definition: timestamp.c:890
#define SECS_PER_HOUR
Definition: timestamp.h:127
#define USECS_PER_SEC
Definition: timestamp.h:134
#define DirectFunctionCall3(func, arg1, arg2, arg3)
Definition: fmgr.h:645
long val
Definition: informix.c:689
pg_tz * pg_tzset_offset(long gmtoffset)
Definition: pgtz.c:320
static Datum CStringGetDatum(const char *X)
Definition: postgres.h:350
static Datum Int32GetDatum(int32 X)
Definition: postgres.h:212
static Interval * DatumGetIntervalP(Datum X)
Definition: timestamp.h:40

References CStringGetDatum(), DatumGetIntervalP(), DirectFunctionCall3, GUC_check_errdetail, GUC_check_errmsg, guc_malloc(), Int32GetDatum(), interval_in(), InvalidOid, LOG, interval::month, newval, ObjectIdGetDatum(), pfree(), pg_strncasecmp(), pg_tz_acceptable(), pg_tzset(), pg_tzset_offset(), pstrdup(), SECS_PER_HOUR, interval::time, USECS_PER_SEC, and val.

◆ check_timezone_abbreviations()

bool check_timezone_abbreviations ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 485 of file variable.c.

486 {
487  /*
488  * The boot_val for timezone_abbreviations is NULL. When we see that we
489  * just do nothing. If the value isn't overridden from the config file
490  * then pg_timezone_abbrev_initialize() will eventually replace it with
491  * "Default". This hack has two purposes: to avoid wasting cycles loading
492  * values that might soon be overridden from the config file, and to avoid
493  * trying to read the timezone abbrev files during InitializeGUCOptions().
494  * The latter doesn't work in an EXEC_BACKEND subprocess because
495  * my_exec_path hasn't been set yet and so we can't locate PGSHAREDIR.
496  */
497  if (*newval == NULL)
498  {
500  return true;
501  }
502 
503  /* OK, load the file and produce a guc_malloc'd TimeZoneAbbrevTable */
504  *extra = load_tzoffsets(*newval);
505 
506  /* tzparser.c returns NULL on failure, reporting via GUC_check_errmsg */
507  if (!*extra)
508  return false;
509 
510  return true;
511 }
TimeZoneAbbrevTable * load_tzoffsets(const char *filename)
Definition: tzparser.c:449

References Assert, load_tzoffsets(), newval, PGC_S_DEFAULT, and source.

◆ check_transaction_buffers()

bool check_transaction_buffers ( int *  newval,
void **  extra,
GucSource  source 
)

Definition at line 821 of file clog.c.

822 {
823  return check_slru_buffers("transaction_buffers", newval);
824 }

References check_slru_buffers(), and newval.

◆ check_transaction_deferrable()

bool check_transaction_deferrable ( bool *  newval,
void **  extra,
GucSource  source 
)

Definition at line 622 of file variable.c.

623 {
624  /* Just accept the value when restoring state in a parallel worker */
626  return true;
627 
628  if (IsSubTransaction())
629  {
630  GUC_check_errcode(ERRCODE_ACTIVE_SQL_TRANSACTION);
631  GUC_check_errmsg("SET TRANSACTION [NOT] DEFERRABLE cannot be called within a subtransaction");
632  return false;
633  }
634  if (FirstSnapshotSet)
635  {
636  GUC_check_errcode(ERRCODE_ACTIVE_SQL_TRANSACTION);
637  GUC_check_errmsg("SET TRANSACTION [NOT] DEFERRABLE must be called before any query");
638  return false;
639  }
640 
641  return true;
642 }
bool FirstSnapshotSet
Definition: snapmgr.c:135
bool IsSubTransaction(void)
Definition: xact.c:5036

References FirstSnapshotSet, GUC_check_errcode(), GUC_check_errmsg, InitializingParallelWorker, and IsSubTransaction().

◆ check_transaction_isolation()

bool check_transaction_isolation ( int *  newval,
void **  extra,
GucSource  source 
)

Definition at line 584 of file variable.c.

585 {
586  int newXactIsoLevel = *newval;
587 
588  if (newXactIsoLevel != XactIsoLevel &&
590  {
591  if (FirstSnapshotSet)
592  {
593  GUC_check_errcode(ERRCODE_ACTIVE_SQL_TRANSACTION);
594  GUC_check_errmsg("SET TRANSACTION ISOLATION LEVEL must be called before any query");
595  return false;
596  }
597  /* We ignore a subtransaction setting it to the existing value. */
598  if (IsSubTransaction())
599  {
600  GUC_check_errcode(ERRCODE_ACTIVE_SQL_TRANSACTION);
601  GUC_check_errmsg("SET TRANSACTION ISOLATION LEVEL must not be called in a subtransaction");
602  return false;
603  }
604  /* Can't go to serializable mode while recovery is still active */
605  if (newXactIsoLevel == XACT_SERIALIZABLE && RecoveryInProgress())
606  {
607  GUC_check_errcode(ERRCODE_FEATURE_NOT_SUPPORTED);
608  GUC_check_errmsg("cannot use serializable mode in a hot standby");
609  GUC_check_errhint("You can use REPEATABLE READ instead.");
610  return false;
611  }
612  }
613 
614  return true;
615 }
int XactIsoLevel
Definition: xact.c:78
#define XACT_SERIALIZABLE
Definition: xact.h:39
bool RecoveryInProgress(void)
Definition: xlog.c:6334

References FirstSnapshotSet, GUC_check_errcode(), GUC_check_errhint, GUC_check_errmsg, InitializingParallelWorker, IsSubTransaction(), IsTransactionState(), newval, RecoveryInProgress(), XACT_SERIALIZABLE, and XactIsoLevel.

◆ check_transaction_read_only()

bool check_transaction_read_only ( bool *  newval,
void **  extra,
GucSource  source 
)

Definition at line 544 of file variable.c.

545 {
547  {
548  /* Can't go to r/w mode inside a r/o transaction */
549  if (IsSubTransaction())
550  {
551  GUC_check_errcode(ERRCODE_ACTIVE_SQL_TRANSACTION);
552  GUC_check_errmsg("cannot set transaction read-write mode inside a read-only transaction");
553  return false;
554  }
555  /* Top level transaction can't change to r/w after first snapshot. */
556  if (FirstSnapshotSet)
557  {
558  GUC_check_errcode(ERRCODE_ACTIVE_SQL_TRANSACTION);
559  GUC_check_errmsg("transaction read-write mode must be set before any query");
560  return false;
561  }
562  /* Can't go to r/w mode while recovery is still active */
563  if (RecoveryInProgress())
564  {
565  GUC_check_errcode(ERRCODE_FEATURE_NOT_SUPPORTED);
566  GUC_check_errmsg("cannot set transaction read-write mode during recovery");
567  return false;
568  }
569  }
570 
571  return true;
572 }
bool XactReadOnly
Definition: xact.c:81

References FirstSnapshotSet, GUC_check_errcode(), GUC_check_errmsg, InitializingParallelWorker, IsSubTransaction(), IsTransactionState(), newval, RecoveryInProgress(), and XactReadOnly.

◆ check_vacuum_buffer_usage_limit()

bool check_vacuum_buffer_usage_limit ( int *  newval,
void **  extra,
GucSource  source 
)

Definition at line 124 of file vacuum.c.

126 {
127  /* Value upper and lower hard limits are inclusive */
128  if (*newval == 0 || (*newval >= MIN_BAS_VAC_RING_SIZE_KB &&
130  return true;
131 
132  /* Value does not fall within any allowable range */
133  GUC_check_errdetail("\"%s\" must be 0 or between %d kB and %d kB.",
134  "vacuum_buffer_usage_limit",
136 
137  return false;
138 }
#define MIN_BAS_VAC_RING_SIZE_KB
Definition: miscadmin.h:277
#define MAX_BAS_VAC_RING_SIZE_KB
Definition: miscadmin.h:278

References GUC_check_errdetail, MAX_BAS_VAC_RING_SIZE_KB, MIN_BAS_VAC_RING_SIZE_KB, and newval.

◆ check_wal_buffers()

bool check_wal_buffers ( int *  newval,
void **  extra,
GucSource  source 
)

Definition at line 4637 of file xlog.c.

4638 {
4639  /*
4640  * -1 indicates a request for auto-tune.
4641  */
4642  if (*newval == -1)
4643  {
4644  /*
4645  * If we haven't yet changed the boot_val default of -1, just let it
4646  * be. We'll fix it when XLOGShmemSize is called.
4647  */
4648  if (XLOGbuffers == -1)
4649  return true;
4650 
4651  /* Otherwise, substitute the auto-tune value */
4653  }
4654 
4655  /*
4656  * We clamp manually-set values to at least 4 blocks. Prior to PostgreSQL
4657  * 9.1, a minimum of 4 was enforced by guc.c, but since that is no longer
4658  * the case, we just silently treat such values as a request for the
4659  * minimum. (We could throw an error instead, but that doesn't seem very
4660  * helpful.)
4661  */
4662  if (*newval < 4)
4663  *newval = 4;
4664 
4665  return true;
4666 }
static int XLOGChooseNumBuffers(void)
Definition: xlog.c:4621
int XLOGbuffers
Definition: xlog.c:117

References newval, XLOGbuffers, and XLOGChooseNumBuffers().

◆ check_wal_consistency_checking()

bool check_wal_consistency_checking ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 4672 of file xlog.c.

4673 {
4674  char *rawstring;
4675  List *elemlist;
4676  ListCell *l;
4677  bool newwalconsistency[RM_MAX_ID + 1];
4678 
4679  /* Initialize the array */
4680  MemSet(newwalconsistency, 0, (RM_MAX_ID + 1) * sizeof(bool));
4681 
4682  /* Need a modifiable copy of string */
4683  rawstring = pstrdup(*newval);
4684 
4685  /* Parse string into list of identifiers */
4686  if (!SplitIdentifierString(rawstring, ',', &elemlist))
4687  {
4688  /* syntax error in list */
4689  GUC_check_errdetail("List syntax is invalid.");
4690  pfree(rawstring);
4691  list_free(elemlist);
4692  return false;
4693  }
4694 
4695  foreach(l, elemlist)
4696  {
4697  char *tok = (char *) lfirst(l);
4698  int rmid;
4699 
4700  /* Check for 'all'. */
4701  if (pg_strcasecmp(tok, "all") == 0)
4702  {
4703  for (rmid = 0; rmid <= RM_MAX_ID; rmid++)
4704  if (RmgrIdExists(rmid) && GetRmgr(rmid).rm_mask != NULL)
4705  newwalconsistency[rmid] = true;
4706  }
4707  else
4708  {
4709  /* Check if the token matches any known resource manager. */
4710  bool found = false;
4711 
4712  for (rmid = 0; rmid <= RM_MAX_ID; rmid++)
4713  {
4714  if (RmgrIdExists(rmid) && GetRmgr(rmid).rm_mask != NULL &&
4715  pg_strcasecmp(tok, GetRmgr(rmid).rm_name) == 0)
4716  {
4717  newwalconsistency[rmid] = true;
4718  found = true;
4719  break;
4720  }
4721  }
4722  if (!found)
4723  {
4724  /*
4725  * During startup, it might be a not-yet-loaded custom
4726  * resource manager. Defer checking until
4727  * InitializeWalConsistencyChecking().
4728  */
4730  {
4732  }
4733  else
4734  {
4735  GUC_check_errdetail("Unrecognized key word: \"%s\".", tok);
4736  pfree(rawstring);
4737  list_free(elemlist);
4738  return false;
4739  }
4740  }
4741  }
4742  }
4743 
4744  pfree(rawstring);
4745  list_free(elemlist);
4746 
4747  /* assign new value */
4748  *extra = guc_malloc(ERROR, (RM_MAX_ID + 1) * sizeof(bool));
4749  memcpy(*extra, newwalconsistency, (RM_MAX_ID + 1) * sizeof(bool));
4750  return true;
4751 }
#define MemSet(start, val, len)
Definition: c.h:974
bool process_shared_preload_libraries_done
Definition: miscinit.c:1840
#define RM_MAX_ID
Definition: rmgr.h:33
void(* rm_mask)(char *pagedata, BlockNumber blkno)
static bool check_wal_consistency_checking_deferred
Definition: xlog.c:166
static RmgrData GetRmgr(RmgrId rmid)
static bool RmgrIdExists(RmgrId rmid)

References check_wal_consistency_checking_deferred, ERROR, GetRmgr(), GUC_check_errdetail, guc_malloc(), lfirst, list_free(), MemSet, newval, pfree(), pg_strcasecmp(), process_shared_preload_libraries_done, pstrdup(), RmgrData::rm_mask, RM_MAX_ID, RmgrIdExists(), and SplitIdentifierString().

◆ check_wal_segment_size()

bool check_wal_segment_size ( int *  newval,
void **  extra,
GucSource  source 
)

Definition at line 2205 of file xlog.c.

2206 {
2207  if (!IsValidWalSegSize(*newval))
2208  {
2209  GUC_check_errdetail("The WAL segment size must be a power of two between 1 MB and 1 GB.");
2210  return false;
2211  }
2212 
2213  return true;
2214 }
#define IsValidWalSegSize(size)
Definition: xlog_internal.h:96

References GUC_check_errdetail, IsValidWalSegSize, and newval.

◆ show_archive_command()

const char* show_archive_command ( void  )

Definition at line 4810 of file xlog.c.

4811 {
4812  if (XLogArchivingActive())
4813  return XLogArchiveCommand;
4814  else
4815  return "(disabled)";
4816 }
char * XLogArchiveCommand
Definition: xlog.c:120
#define XLogArchivingActive()
Definition: xlog.h:99

References XLogArchiveCommand, and XLogArchivingActive.

◆ show_data_directory_mode()

const char* show_data_directory_mode ( void  )

Definition at line 1162 of file variable.c.

1163 {
1164  static char buf[12];
1165 
1166  snprintf(buf, sizeof(buf), "%04o", data_directory_mode);
1167  return buf;
1168 }
int data_directory_mode
Definition: globals.c:76
#define snprintf
Definition: port.h:238

References buf, data_directory_mode, and snprintf.

◆ show_in_hot_standby()

const char* show_in_hot_standby ( void  )

Definition at line 4822 of file xlog.c.

4823 {
4824  /*
4825  * We display the actual state based on shared memory, so that this GUC
4826  * reports up-to-date state if examined intra-query. The underlying
4827  * variable (in_hot_standby_guc) changes only when we transmit a new value
4828  * to the client.
4829  */
4830  return RecoveryInProgress() ? "on" : "off";
4831 }

References RecoveryInProgress().

◆ show_log_file_mode()

const char* show_log_file_mode ( void  )

Definition at line 1174 of file variable.c.

1175 {
1176  static char buf[12];
1177 
1178  snprintf(buf, sizeof(buf), "%04o", Log_file_mode);
1179  return buf;
1180 }
int Log_file_mode
Definition: syslogger.c:76

References buf, Log_file_mode, and snprintf.

◆ show_log_timezone()

const char* show_log_timezone ( void  )

Definition at line 463 of file variable.c.

464 {
465  const char *tzn;
466 
467  /* Always show the zone's canonical name */
469 
470  if (tzn != NULL)
471  return tzn;
472 
473  return "unknown";
474 }
const char * pg_get_timezone_name(pg_tz *tz)
Definition: localtime.c:1875

References log_timezone, and pg_get_timezone_name().

◆ show_random_seed()

const char* show_random_seed ( void  )

Definition at line 675 of file variable.c.

676 {
677  return "unavailable";
678 }

◆ show_role()

const char* show_role ( void  )

Definition at line 1032 of file variable.c.

1033 {
1034  /*
1035  * Check whether SET ROLE is active; if not return "none". This is a
1036  * kluge to deal with the fact that SET SESSION AUTHORIZATION logically
1037  * resets SET ROLE to NONE, but we cannot set the GUC role variable from
1038  * assign_session_authorization (because we haven't got enough info to
1039  * call set_config_option).
1040  */
1041  if (!OidIsValid(GetCurrentRoleId()))
1042  return "none";
1043 
1044  /* Otherwise we can just use the GUC string */
1045  return role_string ? role_string : "none";
1046 }
char * role_string
Definition: guc_tables.c:619

References GetCurrentRoleId(), OidIsValid, and role_string.

◆ show_tcp_keepalives_count()

const char* show_tcp_keepalives_count ( void  )

Definition at line 2018 of file pqcomm.c.

2019 {
2020  /* See comments in assign_tcp_keepalives_idle */
2021  static char nbuf[16];
2022 
2023  snprintf(nbuf, sizeof(nbuf), "%d", pq_getkeepalivescount(MyProcPort));
2024  return nbuf;
2025 }
int pq_getkeepalivescount(Port *port)
Definition: pqcomm.c:1799

References MyProcPort, pq_getkeepalivescount(), and snprintf.

◆ show_tcp_keepalives_idle()

const char* show_tcp_keepalives_idle ( void  )

Definition at line 1972 of file pqcomm.c.

1973 {
1974  /* See comments in assign_tcp_keepalives_idle */
1975  static char nbuf[16];
1976 
1977  snprintf(nbuf, sizeof(nbuf), "%d", pq_getkeepalivesidle(MyProcPort));
1978  return nbuf;
1979 }
int pq_getkeepalivesidle(Port *port)
Definition: pqcomm.c:1630

References MyProcPort, pq_getkeepalivesidle(), and snprintf.

◆ show_tcp_keepalives_interval()

const char* show_tcp_keepalives_interval ( void  )

Definition at line 1995 of file pqcomm.c.

1996 {
1997  /* See comments in assign_tcp_keepalives_idle */
1998  static char nbuf[16];
1999 
2000  snprintf(nbuf, sizeof(nbuf), "%d", pq_getkeepalivesinterval(MyProcPort));
2001  return nbuf;
2002 }
int pq_getkeepalivesinterval(Port *port)
Definition: pqcomm.c:1715

References MyProcPort, pq_getkeepalivesinterval(), and snprintf.

◆ show_tcp_user_timeout()

const char* show_tcp_user_timeout ( void  )

Definition at line 2041 of file pqcomm.c.

2042 {
2043  /* See comments in assign_tcp_keepalives_idle */
2044  static char nbuf[16];
2045 
2046  snprintf(nbuf, sizeof(nbuf), "%d", pq_gettcpusertimeout(MyProcPort));
2047  return nbuf;
2048 }
int pq_gettcpusertimeout(Port *port)
Definition: pqcomm.c:1874

References MyProcPort, pq_gettcpusertimeout(), and snprintf.

◆ show_timezone()

const char* show_timezone ( void  )

Definition at line 390 of file variable.c.

391 {
392  const char *tzn;
393 
394  /* Always show the zone's canonical name */
396 
397  if (tzn != NULL)
398  return tzn;
399 
400  return "unknown";
401 }

References pg_get_timezone_name(), and session_timezone.

◆ show_unix_socket_permissions()

const char* show_unix_socket_permissions ( void  )

Definition at line 1186 of file variable.c.

1187 {
1188  static char buf[12];
1189 
1190  snprintf(buf, sizeof(buf), "%04o", Unix_socket_permissions);
1191  return buf;
1192 }
int Unix_socket_permissions
Definition: pqcomm.c:106

References buf, snprintf, and Unix_socket_permissions.