PostgreSQL Source Code git master
Loading...
Searching...
No Matches
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 charshow_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 charshow_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_log_connections (char **newval, void **extra, GucSource source)
 
void assign_log_connections (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)
 
const charshow_effective_wal_level (void)
 
bool check_huge_page_size (int *newval, void **extra, GucSource source)
 
void assign_io_method (int newval, void *extra)
 
bool check_io_max_concurrency (int *newval, void **extra, GucSource source)
 
const charshow_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 charshow_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 charshow_log_timezone (void)
 
void assign_maintenance_io_concurrency (int newval, void *extra)
 
void assign_io_max_combine_limit (int newval, void *extra)
 
void assign_io_combine_limit (int newval, void *extra)
 
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 charshow_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 charshow_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_ssl_sni (bool *newval, void **extra, GucSource source)
 
bool check_stage_log_stats (bool *newval, void **extra, GucSource source)
 
bool check_standard_conforming_strings (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 charshow_tcp_keepalives_count (void)
 
void assign_tcp_keepalives_idle (int newval, void *extra)
 
const charshow_tcp_keepalives_idle (void)
 
void assign_tcp_keepalives_interval (int newval, void *extra)
 
const charshow_tcp_keepalives_interval (void)
 
void assign_tcp_user_timeout (int newval, void *extra)
 
const charshow_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 charshow_timezone (void)
 
bool check_timezone_abbreviations (char **newval, void **extra, GucSource source)
 
void assign_timezone_abbreviations (const char *newval, void *extra)
 
void assign_timing_clock_source (int newval, void *extra)
 
bool check_timing_clock_source (int *newval, void **extra, GucSource source)
 
const charshow_timing_clock_source (void)
 
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 charshow_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)
 
bool check_log_min_messages (char **newval, void **extra, GucSource source)
 
void assign_log_min_messages (const char *newval, void *extra)
 

Function Documentation

◆ assign_application_name()

void assign_application_name ( const char newval,
void extra 
)
extern

Definition at line 1108 of file variable.c.

1109{
1110 /* Update the pg_stat_activity view */
1112}
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 
)
extern

Definition at line 2668 of file elog.c.

2669{
2670 backtrace_function_list = (char *) extra;
2671}
static char * backtrace_function_list
Definition elog.c:121

References backtrace_function_list.

◆ assign_checkpoint_completion_target()

void assign_checkpoint_completion_target ( double  newval,
void extra 
)
extern

Definition at line 2228 of file xlog.c.

2229{
2232}
double CheckPointCompletionTarget
static void CalculateCheckpointSegments(void)
Definition xlog.c:2192

References CalculateCheckpointSegments(), CheckPointCompletionTarget, and newval.

◆ assign_client_encoding()

void assign_client_encoding ( const char newval,
void extra 
)
extern

Definition at line 786 of file variable.c.

787{
788 int encoding = *((int *) extra);
789
790 /*
791 * In a parallel worker, we never override the client encoding that was
792 * set by ParallelWorkerMain().
793 */
794 if (IsParallelWorker())
795 return;
796
797 /* We do not expect an error if PrepareClientEncoding succeeded */
799 elog(LOG, "SetClientEncoding(%d) failed", encoding);
800}
#define LOG
Definition elog.h:32
#define elog(elevel,...)
Definition elog.h:228
#define IsParallelWorker()
Definition parallel.h:62
static char * encoding
Definition initdb.c:139
int SetClientEncoding(int encoding)
Definition mbutils.c:217

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

◆ assign_datestyle()

void assign_datestyle ( const char newval,
void extra 
)
extern

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:127
int DateOrder
Definition globals.c:128
static int fb(int x)

References DateOrder, DateStyle, and fb().

◆ assign_debug_io_direct()

void assign_debug_io_direct ( const char newval,
void extra 
)
extern

Definition at line 4079 of file fd.c.

4080{
4081 int *flags = (int *) extra;
4082
4083 io_direct_flags = *flags;
4084}
int io_direct_flags
Definition fd.c:172

References io_direct_flags.

◆ assign_default_text_search_config()

void assign_default_text_search_config ( const char newval,
void extra 
)
extern

Definition at line 673 of file ts_cache.c.

674{
675 /* Just reset the cache to force a lookup on first use */
677}
#define InvalidOid
static Oid TSCurrentConfigCache
Definition ts_cache.c:79

References InvalidOid, and TSCurrentConfigCache.

◆ assign_io_combine_limit()

void assign_io_combine_limit ( int  newval,
void extra 
)
extern

Definition at line 1169 of file variable.c.

1170{
1172}
int io_max_combine_limit
Definition bufmgr.c:217
int io_combine_limit
Definition bufmgr.c:215
#define Min(x, y)
Definition c.h:1091

References io_combine_limit, io_max_combine_limit, Min, and newval.

◆ assign_io_max_combine_limit()

void assign_io_max_combine_limit ( int  newval,
void extra 
)
extern

Definition at line 1164 of file variable.c.

1165{
1167}
int io_combine_limit_guc
Definition bufmgr.c:216

References io_combine_limit, io_combine_limit_guc, Min, and newval.

◆ assign_io_method()

void assign_io_method ( int  newval,
void extra 
)
extern

Definition at line 1332 of file aio.c.

1333{
1336
1338}
const IoMethodOps * pgaio_method_ops
Definition aio.c:96
static const IoMethodOps *const pgaio_method_ops_table[]
Definition aio.c:84
#define Assert(condition)
Definition c.h:943
#define lengthof(array)
Definition c.h:873

References Assert, fb(), lengthof, newval, pgaio_method_ops, and pgaio_method_ops_table.

◆ assign_locale_messages()

void assign_locale_messages ( const char newval,
void extra 
)
extern

Definition at line 409 of file pg_locale.c.

410{
411 /*
412 * LC_MESSAGES category does not exist everywhere, but accept it anyway.
413 * We ignore failure, as per comment above.
414 */
415#ifdef LC_MESSAGES
417#endif
418}
char * pg_perm_setlocale(int category, const char *locale)
Definition pg_locale.c:172

References fb(), newval, and pg_perm_setlocale().

◆ assign_locale_monetary()

void assign_locale_monetary ( const char newval,
void extra 
)
extern

Definition at line 346 of file pg_locale.c.

347{
349}
static bool CurrentLocaleConvValid
Definition pg_locale.c:109

References CurrentLocaleConvValid.

◆ assign_locale_numeric()

void assign_locale_numeric ( const char newval,
void extra 
)
extern

Definition at line 358 of file pg_locale.c.

359{
361}

References CurrentLocaleConvValid.

◆ assign_locale_time()

void assign_locale_time ( const char newval,
void extra 
)
extern

Definition at line 370 of file pg_locale.c.

371{
372 CurrentLCTimeValid = false;
373}
static bool CurrentLCTimeValid
Definition pg_locale.c:110

References CurrentLCTimeValid.

◆ assign_log_connections()

void assign_log_connections ( const char newval,
void extra 
)
extern

Definition at line 1126 of file backend_startup.c.

1127{
1128 log_connections = *((int *) extra);
1129}
uint32 log_connections

References log_connections.

◆ assign_log_destination()

void assign_log_destination ( const char newval,
void extra 
)
extern

Definition at line 2741 of file elog.c.

2742{
2743 Log_destination = *((int *) extra);
2744}
int Log_destination
Definition elog.c:115

References Log_destination.

◆ assign_log_min_messages()

void assign_log_min_messages ( const char newval,
void extra 
)
extern

Definition at line 2590 of file elog.c.

2591{
2592 for (int i = 0; i < BACKEND_NUM_TYPES; i++)
2593 log_min_messages[i] = ((int *) extra)[i];
2594}
int log_min_messages[]
Definition guc_tables.c:681
int i
Definition isn.c:77
#define BACKEND_NUM_TYPES
Definition miscadmin.h:392

References BACKEND_NUM_TYPES, i, and log_min_messages.

◆ assign_log_timezone()

void assign_log_timezone ( const char newval,
void extra 
)
extern

Definition at line 456 of file variable.c.

457{
458 log_timezone = *((pg_tz **) extra);
459}
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 
)
extern

Definition at line 1146 of file variable.c.

1147{
1148 /*
1149 * Reconfigure recovery prefetching, because a setting it depends on
1150 * changed.
1151 */
1153 if (AmStartupProcess())
1155}
int maintenance_io_concurrency
Definition bufmgr.c:207
#define AmStartupProcess()
Definition miscadmin.h:405
void XLogPrefetchReconfigure(void)

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

◆ assign_max_stack_depth()

void assign_max_stack_depth ( int  newval,
void extra 
)
extern

Definition at line 159 of file stack_depth.c.

160{
162
164}
static ssize_t max_stack_depth_bytes
Definition stack_depth.c:29

References fb(), max_stack_depth_bytes, and newval.

◆ assign_max_wal_size()

void assign_max_wal_size ( int  newval,
void extra 
)
extern

Definition at line 2221 of file xlog.c.

2222{
2225}
int max_wal_size_mb
Definition xlog.c:121

References CalculateCheckpointSegments(), max_wal_size_mb, and newval.

◆ assign_random_seed()

void assign_random_seed ( double  newval,
void extra 
)
extern

Definition at line 668 of file variable.c.

669{
670 /* We'll do this at most once for any setting of the GUC variable */
671 if (*((int *) extra))
673 *((int *) extra) = 0;
674}
#define DirectFunctionCall1(func, arg1)
Definition fmgr.h:684
static Datum Float8GetDatum(float8 X)
Definition postgres.h:502
Datum setseed(PG_FUNCTION_ARGS)

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

◆ assign_recovery_prefetch()

void assign_recovery_prefetch ( int  new_value,
void extra 
)
extern

Definition at line 1100 of file xlogprefetcher.c.

1101{
1102 /* Reconfigure prefetching, because a setting it depends on changed. */
1104 if (AmStartupProcess())
1106}
int recovery_prefetch

References AmStartupProcess, fb(), recovery_prefetch, and XLogPrefetchReconfigure().

◆ assign_recovery_target()

void assign_recovery_target ( const char newval,
void extra 
)
extern

Definition at line 4811 of file xlogrecovery.c.

4812{
4816
4817 if (newval && strcmp(newval, "") != 0)
4819 else
4821}
RecoveryTargetType recoveryTarget
static pg_noreturn void error_multiple_recovery_targets(void)
@ RECOVERY_TARGET_IMMEDIATE
@ RECOVERY_TARGET_UNSET

References error_multiple_recovery_targets(), fb(), newval, RECOVERY_TARGET_IMMEDIATE, RECOVERY_TARGET_UNSET, and recoveryTarget.

◆ assign_recovery_target_lsn()

void assign_recovery_target_lsn ( const char newval,
void extra 
)
extern

Definition at line 4852 of file xlogrecovery.c.

4853{
4857
4858 if (newval && strcmp(newval, "") != 0)
4859 {
4861 recoveryTargetLSN = *((XLogRecPtr *) extra);
4862 }
4863 else
4865}
uint64 XLogRecPtr
Definition xlogdefs.h:21
XLogRecPtr recoveryTargetLSN
@ RECOVERY_TARGET_LSN

References error_multiple_recovery_targets(), fb(), newval, RECOVERY_TARGET_LSN, RECOVERY_TARGET_UNSET, recoveryTarget, and recoveryTargetLSN.

◆ assign_recovery_target_name()

void assign_recovery_target_name ( const char newval,
void extra 
)
extern

◆ assign_recovery_target_time()

void assign_recovery_target_time ( const char newval,
void extra 
)
extern

◆ assign_recovery_target_timeline()

void assign_recovery_target_timeline ( const char newval,
void extra 
)
extern

Definition at line 5030 of file xlogrecovery.c.

5031{
5035 else
5037}
uint32 TimeLineID
Definition xlogdefs.h:63
RecoveryTargetTimeLineGoal recoveryTargetTimeLineGoal
TimeLineID recoveryTargetTLIRequested
RecoveryTargetTimeLineGoal
@ RECOVERY_TARGET_TIMELINE_NUMERIC

References fb(), newval, RECOVERY_TARGET_TIMELINE_NUMERIC, recoveryTargetTimeLineGoal, and recoveryTargetTLIRequested.

◆ assign_recovery_target_xid()

void assign_recovery_target_xid ( const char newval,
void extra 
)
extern

Definition at line 5095 of file xlogrecovery.c.

5096{
5100
5101 if (newval && strcmp(newval, "") != 0)
5102 {
5104 recoveryTargetXid = *((TransactionId *) extra);
5105 }
5106 else
5108}
uint32 TransactionId
Definition c.h:736
TransactionId recoveryTargetXid
@ RECOVERY_TARGET_XID

References error_multiple_recovery_targets(), fb(), 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 
)
extern

Definition at line 3735 of file postgres.c.

3736{
3737 int *flags = (int *) extra;
3738
3740}
int restrict_nonsystem_relation_kind
Definition postgres.c:111

References restrict_nonsystem_relation_kind.

◆ assign_role()

void assign_role ( const char newval,
void extra 
)
extern

Definition at line 1026 of file variable.c.

1027{
1029
1030 SetCurrentRoleId(myextra->roleid, myextra->is_superuser);
1031}
void SetCurrentRoleId(Oid roleid, bool is_superuser)
Definition miscinit.c:958

References fb(), and SetCurrentRoleId().

◆ assign_search_path()

void assign_search_path ( const char newval,
void extra 
)
extern

Definition at line 4785 of file namespace.c.

4786{
4787 /* don't access search_path during bootstrap */
4789
4790 /*
4791 * We mark the path as needing recomputation, but don't do anything until
4792 * it's needed. This avoids trying to do database access during GUC
4793 * initialization, or outside a transaction.
4794 *
4795 * This does not invalidate the search path cache, so if this value had
4796 * been previously set and no syscache invalidations happened,
4797 * recomputation may not be necessary.
4798 */
4799 baseSearchPathValid = false;
4800}
#define IsBootstrapProcessingMode()
Definition miscadmin.h:495
static bool baseSearchPathValid
Definition namespace.c:158

References Assert, baseSearchPathValid, and IsBootstrapProcessingMode.

◆ assign_session_authorization()

void assign_session_authorization ( const char newval,
void extra 
)
extern

Definition at line 912 of file variable.c.

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

References fb(), and SetSessionAuthorization().

◆ assign_session_replication_role()

void assign_session_replication_role ( int  newval,
void extra 
)
extern

Definition at line 6751 of file trigger.c.

6752{
6753 /*
6754 * Must flush the plan cache when changing replication role; but don't
6755 * flush unnecessarily.
6756 */
6759}
void ResetPlanCache(void)
Definition plancache.c:2328
int SessionReplicationRole
Definition trigger.c:65

References newval, ResetPlanCache(), and SessionReplicationRole.

◆ assign_stats_fetch_consistency()

void assign_stats_fetch_consistency ( int  newval,
void extra 
)
extern

Definition at line 2129 of file pgstat.c.

2131{
2132 /*
2133 * Changing this value in a transaction may cause snapshot state
2134 * inconsistencies, so force a clear of the current snapshot on the next
2135 * snapshot build attempt.
2136 */
int pgstat_fetch_consistency
Definition pgstat.c:205
static bool force_stats_snapshot_clear
Definition pgstat.c:256

References force_stats_snapshot_clear, newval, and pgstat_fetch_consistency.

◆ assign_synchronized_standby_slots()

void assign_synchronized_standby_slots ( const char newval,
void extra 
)
extern

Definition at line 3065 of file slot.c.

3066{
3067 /*
3068 * The standby slots may have changed, so we must recompute the oldest
3069 * LSN.
3070 */
3072
3074}
static XLogRecPtr ss_oldest_flush_lsn
Definition slot.c:185
static SyncStandbySlotsConfigData * synchronized_standby_slots_config
Definition slot.c:179
#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 
)
extern

Definition at line 1136 of file syncrep.c.

1137{
1138 switch (newval)
1139 {
1142 break;
1145 break;
1148 break;
1149 default:
1151 break;
1152 }
1153}
static int SyncRepWaitMode
Definition syncrep.c:99
#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:73
@ SYNCHRONOUS_COMMIT_REMOTE_APPLY
Definition xact.h:76
@ SYNCHRONOUS_COMMIT_REMOTE_FLUSH
Definition xact.h:75

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 
)
extern

Definition at line 1130 of file syncrep.c.

1131{
1132 SyncRepConfig = (SyncRepConfigData *) extra;
1133}
SyncRepConfigData * SyncRepConfig
Definition syncrep.c:98

References SyncRepConfig.

◆ assign_syslog_facility()

void assign_syslog_facility ( int  newval,
void extra 
)
extern

Definition at line 2782 of file elog.c.

2783{
2784#ifdef HAVE_SYSLOG
2785 /*
2786 * As above, don't thrash the syslog connection unnecessarily.
2787 */
2788 if (syslog_facility != newval)
2789 {
2790 if (openlog_done)
2791 {
2792 closelog();
2793 openlog_done = false;
2794 }
2796 }
2797#endif
2798 /* Without syslog support, just ignore it */
2799}
static int syslog_facility
Definition guc_tables.c:633

References fb(), newval, and syslog_facility.

◆ assign_syslog_ident()

void assign_syslog_ident ( const char newval,
void extra 
)
extern

Definition at line 2750 of file elog.c.

2751{
2752#ifdef HAVE_SYSLOG
2753 /*
2754 * guc.c is likely to call us repeatedly with same parameters, so don't
2755 * thrash the syslog connection unnecessarily. Also, we do not re-open
2756 * the connection until needed, since this routine will get called whether
2757 * or not Log_destination actually mentions syslog.
2758 *
2759 * Note that we make our own copy of the ident string rather than relying
2760 * on guc.c's. This may be overly paranoid, but it ensures that we cannot
2761 * accidentally free a string that syslog is still using.
2762 */
2763 if (syslog_ident == NULL || strcmp(syslog_ident, newval) != 0)
2764 {
2765 if (openlog_done)
2766 {
2767 closelog();
2768 openlog_done = false;
2769 }
2772 /* if the strdup fails, we will cope in write_syslog() */
2773 }
2774#endif
2775 /* Without syslog support, just ignore it */
2776}
#define free(a)

References fb(), free, and newval.

◆ assign_tcp_keepalives_count()

void assign_tcp_keepalives_count ( int  newval,
void extra 
)
extern

Definition at line 2011 of file pqcomm.c.

2012{
2013 /* See comments in assign_tcp_keepalives_idle */
2015}
struct Port * MyProcPort
Definition globals.c:53
int pq_setkeepalivescount(int count, Port *port)
Definition pqcomm.c:1832

References fb(), MyProcPort, newval, and pq_setkeepalivescount().

◆ assign_tcp_keepalives_idle()

void assign_tcp_keepalives_idle ( int  newval,
void extra 
)
extern

Definition at line 1955 of file pqcomm.c.

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

References fb(), MyProcPort, newval, and pq_setkeepalivesidle().

◆ assign_tcp_keepalives_interval()

void assign_tcp_keepalives_interval ( int  newval,
void extra 
)
extern

Definition at line 1988 of file pqcomm.c.

1989{
1990 /* See comments in assign_tcp_keepalives_idle */
1992}
int pq_setkeepalivesinterval(int interval, Port *port)
Definition pqcomm.c:1753

References fb(), MyProcPort, newval, and pq_setkeepalivesinterval().

◆ assign_tcp_user_timeout()

void assign_tcp_user_timeout ( int  newval,
void extra 
)
extern

Definition at line 2034 of file pqcomm.c.

2035{
2036 /* See comments in assign_tcp_keepalives_idle */
2038}
int pq_settcpusertimeout(int timeout, Port *port)
Definition pqcomm.c:1907

References fb(), MyProcPort, newval, and pq_settcpusertimeout().

◆ assign_temp_tablespaces()

void assign_temp_tablespaces ( const char newval,
void extra 
)
extern

Definition at line 1320 of file tablespace.c.

1321{
1323
1324 /*
1325 * If check_temp_tablespaces was executed inside a transaction, then pass
1326 * the list it made to fd.c. Otherwise, clear fd.c's list; we must be
1327 * still outside a transaction, or else restoring during transaction exit,
1328 * and in either case we can just let the next PrepareTempTablespaces call
1329 * make things sane.
1330 */
1331 if (myextra)
1332 SetTempTablespaces(myextra->tblSpcs, myextra->numSpcs);
1333 else
1335}
void SetTempTablespaces(Oid *tableSpaces, int numSpaces)
Definition fd.c:3097

References fb(), and SetTempTablespaces().

◆ assign_timezone()

void assign_timezone ( const char newval,
void extra 
)
extern

Definition at line 381 of file variable.c.

382{
383 session_timezone = *((pg_tz **) extra);
384 /* datetime.c's cache of timezone abbrevs may now be obsolete */
386}
void ClearTimeZoneAbbrevCache(void)
Definition datetime.c:3228
PGDLLIMPORT pg_tz * session_timezone
Definition pgtz.c:28

References ClearTimeZoneAbbrevCache(), and session_timezone.

◆ assign_timezone_abbreviations()

void assign_timezone_abbreviations ( const char newval,
void extra 
)
extern

Definition at line 519 of file variable.c.

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

References InstallTimeZoneAbbrevs().

◆ assign_timing_clock_source()

void assign_timing_clock_source ( int  newval,
void extra 
)
extern

Definition at line 409 of file instrument.c.

410{
411#ifdef EXEC_BACKEND
413 return;
414#else
416#endif
417
418 /*
419 * Ignore the return code since the check hook already verified TSC is
420 * usable if it's explicitly requested.
421 */
423}
bool pg_set_timing_clock_source(TimingClockSourceType source)
Definition instr_time.c:92
bool timing_initialized
Definition instr_time.c:63

References Assert, newval, pg_set_timing_clock_source(), and timing_initialized.

◆ assign_transaction_timeout()

void assign_transaction_timeout ( int  newval,
void extra 
)
extern

Definition at line 3664 of file postgres.c.

3665{
3666 if (IsTransactionState())
3667 {
3668 /*
3669 * If transaction_timeout GUC has changed within the transaction block
3670 * enable or disable the timer correspondingly.
3671 */
3676 }
3677}
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:389

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 
)
extern

Definition at line 5161 of file xlog.c.

5162{
5163 /*
5164 * If some checks were deferred, it's possible that the checks will fail
5165 * later during InitializeWalConsistencyChecking(). But in that case, the
5166 * postmaster will exit anyway, so it's safe to proceed with the
5167 * assignment.
5168 *
5169 * Any built-in resource managers specified are assigned immediately,
5170 * which affects WAL created before shared_preload_libraries are
5171 * processed. Any custom resource managers specified won't be assigned
5172 * until after shared_preload_libraries are processed, but that's OK
5173 * because WAL for a custom resource manager can't be written before the
5174 * module is loaded anyway.
5175 */
5177}
bool * wal_consistency_checking
Definition xlog.c:133

References wal_consistency_checking.

◆ assign_wal_sync_method()

void assign_wal_sync_method ( int  new_wal_sync_method,
void extra 
)
extern

Definition at line 9332 of file xlog.c.

9333{
9335 {
9336 /*
9337 * To ensure that no blocks escape unsynced, force an fsync on the
9338 * currently open log segment (if any). Also, if the open flag is
9339 * changing, close the log file so it will be reopened (with new flag
9340 * bit) at next use.
9341 */
9342 if (openLogFile >= 0)
9343 {
9345 if (pg_fsync(openLogFile) != 0)
9346 {
9347 char xlogfname[MAXFNAMELEN];
9348 int save_errno;
9349
9350 save_errno = errno;
9353 errno = save_errno;
9354 ereport(PANIC,
9356 errmsg("could not fsync file \"%s\": %m", xlogfname)));
9357 }
9358
9361 XLogFileClose();
9362 }
9363 }
9364}
int errcode_for_file_access(void)
Definition elog.c:897
#define PANIC
Definition elog.h:44
#define ereport(elevel,...)
Definition elog.h:152
int pg_fsync(int fd)
Definition fd.c:390
static char * errmsg
static void pgstat_report_wait_start(uint32 wait_event_info)
Definition wait_event.h:67
static void pgstat_report_wait_end(void)
Definition wait_event.h:83
static int openLogFile
Definition xlog.c:655
int wal_segment_size
Definition xlog.c:150
static int get_sync_bit(int method)
Definition xlog.c:9284
int wal_sync_method
Definition xlog.c:137
static TimeLineID openLogTLI
Definition xlog.c:657
static void XLogFileClose(void)
Definition xlog.c:3694
static XLogSegNo openLogSegNo
Definition xlog.c:656
#define MAXFNAMELEN
static void XLogFileName(char *fname, TimeLineID tli, XLogSegNo logSegNo, int wal_segsz_bytes)

References ereport, errcode_for_file_access(), errmsg, fb(), 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 
)
extern

Definition at line 1080 of file variable.c.

1081{
1082 char *clean;
1083 char *ret;
1084
1085 /* Only allow clean ASCII chars in the application name */
1087 if (!clean)
1088 return false;
1089
1090 ret = guc_strdup(LOG, clean);
1091 if (!ret)
1092 {
1093 pfree(clean);
1094 return false;
1095 }
1096
1097 guc_free(*newval);
1098
1099 pfree(clean);
1100 *newval = ret;
1101 return true;
1102}
#define MCXT_ALLOC_NO_OOM
Definition fe_memutils.h:29
void guc_free(void *ptr)
Definition guc.c:688
char * guc_strdup(int elevel, const char *src)
Definition guc.c:676
void pfree(void *pointer)
Definition mcxt.c:1616
char * pg_clean_ascii(const char *str, int alloc_flags)
Definition string.c:85

References fb(), guc_free(), guc_strdup(), LOG, MCXT_ALLOC_NO_OOM, newval, pfree(), and pg_clean_ascii().

◆ check_autovacuum_work_mem()

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

Definition at line 3579 of file autovacuum.c.

3580{
3581 /*
3582 * -1 indicates fallback.
3583 *
3584 * If we haven't yet changed the boot_val default of -1, just let it be.
3585 * Autovacuum will look to maintenance_work_mem instead.
3586 */
3587 if (*newval == -1)
3588 return true;
3589
3590 /*
3591 * We clamp manually-set values to at least 64kB. Since
3592 * maintenance_work_mem is always set to at least this value, do the same
3593 * here.
3594 */
3595 if (*newval < 64)
3596 *newval = 64;
3597
3598 return true;
3599}

References newval.

◆ check_backtrace_functions()

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

Definition at line 2607 of file elog.c.

2608{
2609 int newvallen = strlen(*newval);
2610 char *someval;
2611 int validlen;
2612 int i;
2613 int j;
2614
2615 /*
2616 * Allow characters that can be C identifiers and commas as separators, as
2617 * well as some whitespace for readability.
2618 */
2620 "0123456789_"
2621 "abcdefghijklmnopqrstuvwxyz"
2622 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
2623 ", \n\t");
2624 if (validlen != newvallen)
2625 {
2626 GUC_check_errdetail("Invalid character.");
2627 return false;
2628 }
2629
2630 if ((*newval)[0] == '\0')
2631 {
2632 *extra = NULL;
2633 return true;
2634 }
2635
2636 /*
2637 * Allocate space for the output and create the copy. We could discount
2638 * whitespace chars to save some memory, but it doesn't seem worth the
2639 * trouble.
2640 */
2641 someval = guc_malloc(LOG, newvallen + 1 + 1);
2642 if (!someval)
2643 return false;
2644 for (i = 0, j = 0; i < newvallen; i++)
2645 {
2646 if ((*newval)[i] == ',')
2647 someval[j++] = '\0'; /* next item */
2648 else if ((*newval)[i] == ' ' ||
2649 (*newval)[i] == '\n' ||
2650 (*newval)[i] == '\t')
2651 ; /* ignore these */
2652 else
2653 someval[j++] = (*newval)[i]; /* copy anything else */
2654 }
2655
2656 /* two \0s end the setting */
2657 someval[j] = '\0';
2658 someval[j + 1] = '\0';
2659
2660 *extra = someval;
2661 return true;
2662}
void * guc_malloc(int elevel, size_t size)
Definition guc.c:637
#define GUC_check_errdetail
Definition guc.h:507
int j
Definition isn.c:78

References fb(), GUC_check_errdetail, guc_malloc(), i, j, LOG, and newval.

◆ check_bonjour()

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

Definition at line 1221 of file variable.c.

1222{
1223#ifndef USE_BONJOUR
1224 if (*newval)
1225 {
1226 GUC_check_errmsg("Bonjour is not supported by this build");
1227 return false;
1228 }
1229#endif
1230 return true;
1231}
#define GUC_check_errmsg
Definition guc.h:503

References GUC_check_errmsg, and newval.

◆ check_canonical_path()

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

Definition at line 1059 of file variable.c.

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

References canonicalize_path(), and newval.

◆ check_client_connection_check_interval()

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

Definition at line 3614 of file postgres.c.

3615{
3616 if (!WaitEventSetCanReportClosed() && *newval != 0)
3617 {
3618 GUC_check_errdetail("\"client_connection_check_interval\" must be set to 0 on this platform.");
3619 return false;
3620 }
3621 return true;
3622}
bool WaitEventSetCanReportClosed(void)

References GUC_check_errdetail, newval, and WaitEventSetCanReportClosed().

◆ check_client_encoding()

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

Definition at line 688 of file variable.c.

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

References encoding, fb(), 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 
)
extern

Definition at line 1118 of file variable.c.

1119{
1120 char *clean;
1121 char *ret;
1122
1123 /* Only allow clean ASCII chars in the cluster name */
1125 if (!clean)
1126 return false;
1127
1128 ret = guc_strdup(LOG, clean);
1129 if (!ret)
1130 {
1131 pfree(clean);
1132 return false;
1133 }
1134
1135 guc_free(*newval);
1136
1137 pfree(clean);
1138 *newval = ret;
1139 return true;
1140}

References fb(), guc_free(), guc_strdup(), LOG, MCXT_ALLOC_NO_OOM, newval, pfree(), and pg_clean_ascii().

◆ check_commit_ts_buffers()

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

Definition at line 587 of file commit_ts.c.

588{
589 return check_slru_buffers("commit_timestamp_buffers", newval);
590}
bool check_slru_buffers(const char *name, int *newval)
Definition slru.c:377

References check_slru_buffers(), and newval.

◆ check_datestyle()

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

Definition at line 52 of file variable.c.

53{
56 bool have_style = false;
57 bool have_order = false;
58 bool ok = true;
59 char *rawstring;
60 int *myextra;
61 char *result;
63 ListCell *l;
64
65 /* Need a modifiable copy of string */
67
68 /* Parse string into list of identifiers */
70 {
71 /* syntax error in list */
72 GUC_check_errdetail("List syntax is invalid.");
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 {
87 ok = false; /* conflicting styles */
89 have_style = true;
90 }
91 else if (pg_strcasecmp(tok, "SQL") == 0)
92 {
94 ok = false; /* conflicting styles */
96 have_style = true;
97 }
98 else if (pg_strncasecmp(tok, "POSTGRES", 8) == 0)
99 {
101 ok = false; /* conflicting styles */
103 have_style = true;
104 }
105 else if (pg_strcasecmp(tok, "GERMAN") == 0)
106 {
108 ok = false; /* conflicting styles */
110 have_style = true;
111 /* GERMAN also sets DMY, unless explicitly overridden */
112 if (!have_order)
114 }
115 else if (pg_strcasecmp(tok, "YMD") == 0)
116 {
118 ok = false; /* conflicting orders */
120 have_order = true;
121 }
122 else if (pg_strcasecmp(tok, "DMY") == 0 ||
123 pg_strncasecmp(tok, "EURO", 4) == 0)
124 {
126 ok = false; /* conflicting orders */
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 {
135 ok = false; /* conflicting orders */
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
152 if (!subval)
153 {
154 ok = false;
155 break;
156 }
158 {
160 ok = false;
161 break;
162 }
163 myextra = (int *) subextra;
164 if (!have_style)
166 if (!have_order)
170 }
171 else
172 {
173 GUC_check_errdetail("Unrecognized key word: \"%s\".", tok);
176 return false;
177 }
178 }
179
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
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;
235 *extra = myextra;
236
237 return true;
238}
bool check_datestyle(char **newval, void **extra, GucSource source)
Definition variable.c:52
uint32 result
const char * GetConfigOptionResetString(const char *name)
Definition guc.c:4307
void list_free(List *list)
Definition list.c:1546
char * pstrdup(const char *in)
Definition mcxt.c:1781
#define USE_SQL_DATES
Definition miscadmin.h:241
#define USE_POSTGRES_DATES
Definition miscadmin.h:239
#define USE_ISO_DATES
Definition miscadmin.h:240
#define DATEORDER_DMY
Definition miscadmin.h:247
#define DATEORDER_MDY
Definition miscadmin.h:248
#define DATEORDER_YMD
Definition miscadmin.h:246
#define USE_GERMAN_DATES
Definition miscadmin.h:242
#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)
int pg_strncasecmp(const char *s1, const char *s2, size_t n)
Definition pg_list.h:54
bool SplitIdentifierString(char *rawstring, char separator, List **namelist)
Definition varlena.c:2867

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

Referenced by check_datestyle().

◆ check_debug_io_direct()

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

Definition at line 3992 of file fd.c.

3993{
3994 bool result = true;
3995 int flags;
3996
3997#if PG_O_DIRECT == 0
3998 if (strcmp(*newval, "") != 0)
3999 {
4000 GUC_check_errdetail("\"%s\" is not supported on this platform.",
4001 "debug_io_direct");
4002 result = false;
4003 }
4004 flags = 0;
4005#else
4006 List *elemlist;
4007 ListCell *l;
4008 char *rawstring;
4009
4010 /* Need a modifiable copy of string */
4012
4013 if (!SplitGUCList(rawstring, ',', &elemlist))
4014 {
4015 GUC_check_errdetail("Invalid list syntax in parameter \"%s\".",
4016 "debug_io_direct");
4019 return false;
4020 }
4021
4022 flags = 0;
4023 foreach(l, elemlist)
4024 {
4025 char *item = (char *) lfirst(l);
4026
4027 if (pg_strcasecmp(item, "data") == 0)
4028 flags |= IO_DIRECT_DATA;
4029 else if (pg_strcasecmp(item, "wal") == 0)
4030 flags |= IO_DIRECT_WAL;
4031 else if (pg_strcasecmp(item, "wal_init") == 0)
4032 flags |= IO_DIRECT_WAL_INIT;
4033 else
4034 {
4035 GUC_check_errdetail("Invalid option \"%s\".", item);
4036 result = false;
4037 break;
4038 }
4039 }
4040
4041 /*
4042 * It's possible to configure block sizes smaller than our assumed I/O
4043 * alignment size, which could result in invalid I/O requests.
4044 */
4045#if XLOG_BLCKSZ < PG_IO_ALIGN_SIZE
4046 if (result && (flags & (IO_DIRECT_WAL | IO_DIRECT_WAL_INIT)))
4047 {
4048 GUC_check_errdetail("\"%s\" is not supported for WAL because %s is too small.",
4049 "debug_io_direct", "XLOG_BLCKSZ");
4050 result = false;
4051 }
4052#endif
4053#if BLCKSZ < PG_IO_ALIGN_SIZE
4054 if (result && (flags & IO_DIRECT_DATA))
4055 {
4056 GUC_check_errdetail("\"%s\" is not supported for data because %s is too small.",
4057 "debug_io_direct", "BLCKSZ");
4058 result = false;
4059 }
4060#endif
4061
4064#endif
4065
4066 if (!result)
4067 return result;
4068
4069 /* Save the flags in *extra, for use by assign_debug_io_direct */
4070 *extra = guc_malloc(LOG, sizeof(int));
4071 if (!*extra)
4072 return false;
4073 *((int *) *extra) = flags;
4074
4075 return result;
4076}
#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:3060

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

◆ check_default_table_access_method()

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

Definition at line 101 of file tableamapi.c.

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

References ereport, errcode(), errmsg, fb(), 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 
)
extern

Definition at line 1105 of file tablespace.c.

1106{
1107 /*
1108 * If we aren't inside a transaction, or connected to a database, we
1109 * cannot do the catalog accesses necessary to verify the name. Must
1110 * accept the value on faith.
1111 */
1113 {
1114 if (**newval != '\0' &&
1116 {
1117 /*
1118 * When source == PGC_S_TEST, don't throw a hard error for a
1119 * nonexistent tablespace, only a NOTICE. See comments in guc.h.
1120 */
1121 if (source == PGC_S_TEST)
1122 {
1125 errmsg("tablespace \"%s\" does not exist",
1126 *newval)));
1127 }
1128 else
1129 {
1130 GUC_check_errdetail("Tablespace \"%s\" does not exist.",
1131 *newval);
1132 return false;
1133 }
1134 }
1135 }
1136
1137 return true;
1138}
Oid get_tablespace_oid(const char *tablespacename, bool missing_ok)

References ereport, errcode(), errmsg, fb(), 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 
)
extern

Definition at line 605 of file ts_cache.c.

606{
607 /*
608 * If we aren't inside a transaction, or connected to a database, we
609 * cannot do the catalog accesses necessary to verify the config name.
610 * Must accept it on faith.
611 */
613 {
615 List *namelist;
616 Oid cfgId;
617 HeapTuple tuple;
619 char *buf;
620
622 (Node *) &escontext);
623 if (namelist != NIL)
624 cfgId = get_ts_config_oid(namelist, true);
625 else
626 cfgId = InvalidOid; /* bad name list syntax */
627
628 /*
629 * When source == PGC_S_TEST, don't throw a hard error for a
630 * nonexistent configuration, only a NOTICE. See comments in guc.h.
631 */
632 if (!OidIsValid(cfgId))
633 {
634 if (source == PGC_S_TEST)
635 {
638 errmsg("text search configuration \"%s\" does not exist", *newval)));
639 return true;
640 }
641 else
642 return false;
643 }
644
645 /*
646 * Modify the actually stored value to be fully qualified, to ensure
647 * later changes of search_path don't affect it.
648 */
650 if (!HeapTupleIsValid(tuple))
651 elog(ERROR, "cache lookup failed for text search configuration %u",
652 cfgId);
653 cfg = (Form_pg_ts_config) GETSTRUCT(tuple);
654
656 NameStr(cfg->cfgname));
657
658 ReleaseSysCache(tuple);
659
660 /* GUC wants it guc_malloc'd not palloc'd */
663 pfree(buf);
664 if (!*newval)
665 return false;
666 }
667
668 return true;
669}
#define NameStr(name)
Definition c.h:835
#define ERROR
Definition elog.h:40
#define HeapTupleIsValid(tuple)
Definition htup.h:78
static void * GETSTRUCT(const HeapTupleData *tuple)
char * get_namespace_name(Oid nspid)
Definition lsyscache.c:3588
Oid get_ts_config_oid(List *names, bool missing_ok)
Definition namespace.c:3224
#define NIL
Definition pg_list.h:68
static char buf[DEFAULT_XLOG_SEG_SIZE]
END_CATALOG_STRUCT typedef FormData_pg_ts_config * Form_pg_ts_config
static Datum ObjectIdGetDatum(Oid X)
Definition postgres.h:252
unsigned int Oid
List * stringToQualifiedNameList(const char *string, Node *escontext)
Definition regproc.c:1922
char * quote_qualified_identifier(const char *qualifier, const char *ident)
Definition nodes.h:135
void ReleaseSysCache(HeapTuple tuple)
Definition syscache.c:265
HeapTuple SearchSysCache1(SysCacheIdentifier cacheId, Datum key1)
Definition syscache.c:221

References buf, elog, ereport, errcode(), errmsg, ERROR, fb(), Form_pg_ts_config, 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 
)
extern

Definition at line 1234 of file variable.c.

1235{
1236 if (*newval)
1237 {
1238 /* check the GUC's definition for an explanation */
1240 GUC_check_errmsg("tables declared WITH OIDS are not supported");
1241
1242 return false;
1243 }
1244
1245 return true;
1246}

References fb(), GUC_check_errcode(), GUC_check_errmsg, and newval.

◆ check_huge_page_size()

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

Definition at line 579 of file sysv_shmem.c.

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

References GUC_check_errdetail, and newval.

◆ check_io_max_concurrency()

bool check_io_max_concurrency ( int newval,
void **  extra,
GucSource  source 
)
extern

Definition at line 1341 of file aio.c.

1342{
1343 if (*newval == -1)
1344 {
1345 /*
1346 * Auto-tuning will be applied later during startup, as auto-tuning
1347 * depends on the value of various GUCs.
1348 */
1349 return true;
1350 }
1351 else if (*newval == 0)
1352 {
1353 GUC_check_errdetail("Only -1 or values bigger than 0 are valid.");
1354 return false;
1355 }
1356
1357 return true;
1358}

References GUC_check_errdetail, and newval.

◆ check_locale_messages()

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

Definition at line 386 of file pg_locale.c.

387{
388 if (**newval == '\0')
389 {
390 if (source == PGC_S_DEFAULT)
391 return true;
392 else
393 return false;
394 }
395
396 /*
397 * LC_MESSAGES category does not exist everywhere, but accept it anyway
398 *
399 * On Windows, we can't even check the value, so accept blindly
400 */
401#if defined(LC_MESSAGES) && !defined(WIN32)
403#else
404 return true;
405#endif
406}
@ PGC_S_DEFAULT
Definition guc.h:113
bool check_locale(int category, const char *locale, char **canonname)
Definition pg_locale.c:275

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

◆ check_locale_monetary()

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

Definition at line 340 of file pg_locale.c.

341{
343}

References check_locale(), fb(), and newval.

◆ check_locale_numeric()

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

Definition at line 352 of file pg_locale.c.

353{
355}

References check_locale(), fb(), and newval.

◆ check_locale_time()

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

Definition at line 364 of file pg_locale.c.

365{
366 return check_locale(LC_TIME, *newval, NULL);
367}

References check_locale(), fb(), and newval.

◆ check_log_connections()

bool check_log_connections ( char **  newval,
void **  extra,
GucSource  source 
)
extern

Definition at line 1082 of file backend_startup.c.

1083{
1084 uint32 flags;
1085 char *rawstring;
1086 List *elemlist;
1087 bool success;
1088
1089 /* Need a modifiable copy of string */
1091
1093 {
1094 GUC_check_errdetail("Invalid list syntax in parameter \"%s\".", "log_connections");
1097 return false;
1098 }
1099
1100 /* Validation logic is all in the helper */
1102
1103 /* Time for cleanup */
1106
1107 if (!success)
1108 return false;
1109
1110 /*
1111 * We succeeded, so allocate `extra` and save the flags there for use by
1112 * assign_log_connections().
1113 */
1114 *extra = guc_malloc(LOG, sizeof(int));
1115 if (!*extra)
1116 return false;
1117 *((int *) *extra) = flags;
1118
1119 return true;
1120}
static bool validate_log_connections_options(List *elemlist, uint32 *flags)
uint32_t uint32
Definition c.h:624
static bool success
Definition initdb.c:188

References fb(), GUC_check_errdetail, guc_malloc(), list_free(), LOG, newval, pfree(), pstrdup(), SplitIdentifierString(), success, and validate_log_connections_options().

◆ check_log_destination()

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

Definition at line 2677 of file elog.c.

2678{
2679 char *rawstring;
2680 List *elemlist;
2681 ListCell *l;
2682 int newlogdest = 0;
2683 int *myextra;
2684
2685 /* Need a modifiable copy of string */
2687
2688 /* Parse string into list of identifiers */
2690 {
2691 /* syntax error in list */
2692 GUC_check_errdetail("List syntax is invalid.");
2695 return false;
2696 }
2697
2698 foreach(l, elemlist)
2699 {
2700 char *tok = (char *) lfirst(l);
2701
2702 if (pg_strcasecmp(tok, "stderr") == 0)
2704 else if (pg_strcasecmp(tok, "csvlog") == 0)
2706 else if (pg_strcasecmp(tok, "jsonlog") == 0)
2708#ifdef HAVE_SYSLOG
2709 else if (pg_strcasecmp(tok, "syslog") == 0)
2711#endif
2712#ifdef WIN32
2713 else if (pg_strcasecmp(tok, "eventlog") == 0)
2715#endif
2716 else
2717 {
2718 GUC_check_errdetail("Unrecognized key word: \"%s\".", tok);
2721 return false;
2722 }
2723 }
2724
2727
2728 myextra = (int *) guc_malloc(LOG, sizeof(int));
2729 if (!myextra)
2730 return false;
2732 *extra = myextra;
2733
2734 return true;
2735}
#define LOG_DESTINATION_JSONLOG
Definition elog.h:491
#define LOG_DESTINATION_SYSLOG
Definition elog.h:488
#define LOG_DESTINATION_STDERR
Definition elog.h:487
#define LOG_DESTINATION_EVENTLOG
Definition elog.h:489
#define LOG_DESTINATION_CSVLOG
Definition elog.h:490

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

◆ check_log_min_messages()

bool check_log_min_messages ( char **  newval,
void **  extra,
GucSource  source 
)
extern

Definition at line 2362 of file elog.c.

2363{
2364 char *rawstring;
2365 List *elemlist;
2367 char *result;
2369 bool assigned[BACKEND_NUM_TYPES] = {0};
2370 int defaultlevel = -1; /* -1 means not assigned */
2371
2372 const char *const process_types[] = {
2373#define PG_PROCTYPE(bktype, bkcategory, description, main_func, shmem_attach) \
2374 [bktype] = bkcategory,
2376#undef PG_PROCTYPE
2377 };
2378
2379 /* Need a modifiable copy of string. */
2381 if (rawstring == NULL)
2382 return false;
2383
2384 /* Parse the string into a list. */
2385 if (!SplitGUCList(rawstring, ',', &elemlist))
2386 {
2387 /* syntax error in list */
2388 GUC_check_errdetail("List syntax is invalid.");
2391 return false;
2392 }
2393
2394 /* Validate and assign log level and process type. */
2395 foreach_ptr(char, elem, elemlist)
2396 {
2397 char *sep = strchr(elem, ':');
2398
2399 /*
2400 * If there's no ':' separator in the entry, this is the default log
2401 * level. Otherwise it's a process type-specific entry.
2402 */
2403 if (sep == NULL)
2404 {
2405 const struct config_enum_entry *entry;
2406 bool found;
2407
2408 /* Reject duplicates for default log level. */
2409 if (defaultlevel != -1)
2410 {
2411 GUC_check_errdetail("Redundant specification of default log level.");
2412 goto lmm_fail;
2413 }
2414
2415 /* Validate the log level */
2416 found = false;
2417 for (entry = server_message_level_options; entry && entry->name; entry++)
2418 {
2419 if (pg_strcasecmp(entry->name, elem) == 0)
2420 {
2421 defaultlevel = entry->val;
2422 found = true;
2423 break;
2424 }
2425 }
2426
2427 if (!found)
2428 {
2429 GUC_check_errdetail("Unrecognized log level: \"%s\".", elem);
2430 goto lmm_fail;
2431 }
2432 }
2433 else
2434 {
2435 char *loglevel = sep + 1;
2436 char *ptype = elem;
2437 bool found;
2438 int level;
2439 const struct config_enum_entry *entry;
2440
2441 /*
2442 * Temporarily clobber the ':' with a string terminator, so that
2443 * we can validate it. We restore this at the bottom.
2444 */
2445 *sep = '\0';
2446
2447 /* Validate the log level */
2448 found = false;
2449 for (entry = server_message_level_options; entry && entry->name; entry++)
2450 {
2451 if (pg_strcasecmp(entry->name, loglevel) == 0)
2452 {
2453 level = entry->val;
2454 found = true;
2455 break;
2456 }
2457 }
2458
2459 if (!found)
2460 {
2461 GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".",
2462 ptype, loglevel);
2463 goto lmm_fail;
2464 }
2465
2466 /* Is the process type name valid and unique? */
2467 found = false;
2468 for (int i = 0; i < BACKEND_NUM_TYPES; i++)
2469 {
2470 if (pg_strcasecmp(process_types[i], ptype) == 0)
2471 {
2472 /* Reject duplicates for a process type. */
2473 if (assigned[i])
2474 {
2475 GUC_check_errdetail("Redundant log level specification for process type \"%s\".",
2476 ptype);
2477 goto lmm_fail;
2478 }
2479
2480 newlevel[i] = level;
2481 assigned[i] = true;
2482 found = true;
2483
2484 /*
2485 * note: we must keep looking! some process types appear
2486 * multiple times in proctypelist.h.
2487 */
2488 }
2489 }
2490
2491 if (!found)
2492 {
2493 GUC_check_errdetail("Unrecognized process type \"%s\".", ptype);
2494 goto lmm_fail;
2495 }
2496
2497 /* Put the separator back in place */
2498 *sep = ':';
2499 }
2500
2501 /* all good */
2502 continue;
2503
2504lmm_fail:
2507 return false;
2508 }
2509
2510 /*
2511 * The default log level must be specified. It is the fallback value.
2512 */
2513 if (defaultlevel == -1)
2514 {
2515 GUC_check_errdetail("Default log level was not defined.");
2518 return false;
2519 }
2520
2521 /* Apply the default log level to all processes not listed. */
2522 for (int i = 0; i < BACKEND_NUM_TYPES; i++)
2523 {
2524 if (!assigned[i])
2526 }
2527
2528 /*
2529 * Save an ordered representation of the user-specified string, for the
2530 * show_hook.
2531 */
2533
2535 foreach_ptr(char, elem, elemlist)
2536 {
2537 if (foreach_current_index(elem) == 0)
2539 else
2540 appendStringInfo(&buf, ", %s", elem);
2541 }
2542
2543 result = guc_strdup(LOG, buf.data);
2544 if (!result)
2545 {
2546 pfree(buf.data);
2547 return false;
2548 }
2549
2550 guc_free(*newval);
2551 *newval = result;
2552
2555 pfree(buf.data);
2556
2557 /*
2558 * Pass back data for assign_log_min_messages to use.
2559 */
2560 *extra = guc_malloc(LOG, BACKEND_NUM_TYPES * sizeof(int));
2561 if (!*extra)
2562 return false;
2563 memcpy(*extra, newlevel, BACKEND_NUM_TYPES * sizeof(int));
2564
2565 return true;
2566}
memcpy(sums, checksumBaseOffsets, sizeof(checksumBaseOffsets))
static int log_min_messages_cmp(const ListCell *a, const ListCell *b)
Definition elog.c:2573
const struct config_enum_entry server_message_level_options[]
Definition guc_tables.c:152
void list_sort(List *list, list_sort_comparator cmp)
Definition list.c:1674
#define foreach_current_index(var_or_cell)
Definition pg_list.h:435
#define foreach_ptr(type, var, lst)
Definition pg_list.h:501
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition stringinfo.c:145
void initStringInfoExt(StringInfo str, int initsize)
Definition stringinfo.c:111
void appendStringInfoString(StringInfo str, const char *s)
Definition stringinfo.c:230
Definition guc.h:174
const char * name
Definition guc.h:175
int val
Definition guc.h:176

References appendStringInfo(), appendStringInfoString(), BACKEND_NUM_TYPES, buf, fb(), foreach_current_index, foreach_ptr, GUC_check_errdetail, guc_free(), guc_malloc(), guc_strdup(), i, initStringInfoExt(), list_free(), list_sort(), LOG, log_min_messages_cmp(), memcpy(), config_enum_entry::name, newval, pfree(), pg_strcasecmp(), result, server_message_level_options, SplitGUCList(), and config_enum_entry::val.

◆ check_log_stats()

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

Definition at line 3649 of file postgres.c.

3650{
3651 if (*newval &&
3653 {
3654 GUC_check_errdetail("Cannot enable \"log_statement_stats\" when "
3655 "\"log_parser_stats\", \"log_planner_stats\", "
3656 "or \"log_executor_stats\" is true.");
3657 return false;
3658 }
3659 return true;
3660}
bool log_parser_stats
Definition guc_tables.c:548
bool log_planner_stats
Definition guc_tables.c:549
bool log_executor_stats
Definition guc_tables.c:550

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 
)
extern

Definition at line 418 of file variable.c.

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

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

◆ check_max_stack_depth()

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

Definition at line 142 of file stack_depth.c.

143{
146
148 {
149 GUC_check_errdetail("\"max_stack_depth\" must not exceed %zdkB.",
150 (stack_rlimit - STACK_DEPTH_SLOP) / 1024);
151 GUC_check_errhint("Increase the platform's stack depth limit via \"ulimit -s\" or local equivalent.");
152 return false;
153 }
154 return true;
155}
#define GUC_check_errhint
Definition guc.h:511
#define STACK_DEPTH_SLOP
Definition miscadmin.h:300
ssize_t get_stack_depth_rlimit(void)

References fb(), 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 
)
extern

Definition at line 1852 of file multixact.c.

1853{
1854 return check_slru_buffers("multixact_member_buffers", newval);
1855}

References check_slru_buffers(), and newval.

◆ check_multixact_offset_buffers()

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

Definition at line 1843 of file multixact.c.

1844{
1845 return check_slru_buffers("multixact_offset_buffers", newval);
1846}

References check_slru_buffers(), and newval.

◆ check_notify_buffers()

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

Definition at line 3294 of file async.c.

3295{
3296 return check_slru_buffers("notify_buffers", newval);
3297}

References check_slru_buffers(), and newval.

◆ check_primary_slot_name()

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

Definition at line 4746 of file xlogrecovery.c.

4747{
4748 int err_code;
4749 char *err_msg = NULL;
4750 char *err_hint = NULL;
4751
4752 if (*newval && strcmp(*newval, "") != 0 &&
4754 &err_msg, &err_hint))
4755 {
4757 GUC_check_errdetail("%s", err_msg);
4758 if (err_hint != NULL)
4760 return false;
4761 }
4762
4763 return true;
4764}
bool ReplicationSlotValidateNameInternal(const char *name, bool allow_reserved_name, int *err_code, char **err_msg, char **err_hint)
Definition slot.c:310

References fb(), GUC_check_errcode(), GUC_check_errdetail, GUC_check_errhint, newval, and ReplicationSlotValidateNameInternal().

◆ check_random_seed()

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

Definition at line 656 of file variable.c.

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

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

◆ check_recovery_prefetch()

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

Definition at line 1086 of file xlogprefetcher.c.

1087{
1088#ifndef USE_PREFETCH
1090 {
1091 GUC_check_errdetail("\"recovery_prefetch\" is not supported on platforms that lack support for issuing read-ahead advice.");
1092 return false;
1093 }
1094#endif
1095
1096 return true;
1097}
@ RECOVERY_PREFETCH_ON

References fb(), GUC_check_errdetail, and RECOVERY_PREFETCH_ON.

◆ check_recovery_target()

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

Definition at line 4797 of file xlogrecovery.c.

4798{
4799 if (strcmp(*newval, "immediate") != 0 && strcmp(*newval, "") != 0)
4800 {
4801 GUC_check_errdetail("The only allowed value is \"immediate\".");
4802 return false;
4803 }
4804 return true;
4805}

References fb(), GUC_check_errdetail, and newval.

◆ check_recovery_target_lsn()

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

Definition at line 4827 of file xlogrecovery.c.

4828{
4829 if (strcmp(*newval, "") != 0)
4830 {
4831 XLogRecPtr lsn;
4834
4835 lsn = pg_lsn_in_safe(*newval, (Node *) &escontext);
4836 if (escontext.error_occurred)
4837 return false;
4838
4839 myextra = (XLogRecPtr *) guc_malloc(LOG, sizeof(XLogRecPtr));
4840 if (!myextra)
4841 return false;
4842 *myextra = lsn;
4843 *extra = myextra;
4844 }
4845 return true;
4846}
XLogRecPtr pg_lsn_in_safe(const char *str, Node *escontext)
Definition pg_lsn.c:32

References ErrorSaveContext::error_occurred, fb(), guc_malloc(), LOG, newval, and pg_lsn_in_safe().

◆ check_recovery_target_name()

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

Definition at line 4871 of file xlogrecovery.c.

4872{
4873 /* Use the value of newval directly */
4874 if (strlen(*newval) >= MAXFNAMELEN)
4875 {
4876 GUC_check_errdetail("\"%s\" is too long (maximum %d characters).",
4877 "recovery_target_name", MAXFNAMELEN - 1);
4878 return false;
4879 }
4880 return true;
4881}

References fb(), GUC_check_errdetail, MAXFNAMELEN, and newval.

◆ check_recovery_target_time()

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

Definition at line 4912 of file xlogrecovery.c.

4913{
4914 if (strcmp(*newval, "") != 0)
4915 {
4916 /* reject some special values */
4917 if (strcmp(*newval, "now") == 0 ||
4918 strcmp(*newval, "today") == 0 ||
4919 strcmp(*newval, "tomorrow") == 0 ||
4920 strcmp(*newval, "yesterday") == 0)
4921 {
4922 return false;
4923 }
4924
4925 /*
4926 * parse timestamp value (see also timestamptz_in())
4927 */
4928 {
4929 char *str = *newval;
4930 fsec_t fsec;
4931 struct pg_tm tt,
4932 *tm = &tt;
4933 int tz;
4934 int dtype;
4935 int nf;
4936 int dterr;
4937 char *field[MAXDATEFIELDS];
4938 int ftype[MAXDATEFIELDS];
4942
4944 field, ftype, MAXDATEFIELDS, &nf);
4945 if (dterr == 0)
4946 dterr = DecodeDateTime(field, ftype, nf,
4947 &dtype, tm, &fsec, &tz, &dtextra);
4948 if (dterr != 0)
4949 return false;
4950 if (dtype != DTK_DATE)
4951 return false;
4952
4953 if (tm2timestamp(tm, fsec, &tz, &timestamp) != 0)
4954 {
4955 GUC_check_errdetail("Timestamp out of range: \"%s\".", str);
4956 return false;
4957 }
4958 }
4959 }
4960 return true;
4961}
int ParseDateTime(const char *timestr, char *workbuf, size_t buflen, char **field, int *ftype, int maxfields, int *numfields)
Definition datetime.c:774
int DecodeDateTime(char **field, int *ftype, int nf, int *dtype, struct pg_tm *tm, fsec_t *fsec, int *tzp, DateTimeErrorExtra *extra)
Definition datetime.c:998
int tm2timestamp(struct pg_tm *tm, fsec_t fsec, int *tzp, Timestamp *result)
Definition timestamp.c:2000
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, fb(), 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 
)
extern

Definition at line 4983 of file xlogrecovery.c.

4984{
4987
4988 if (strcmp(*newval, "current") == 0)
4990 else if (strcmp(*newval, "latest") == 0)
4992 else
4993 {
4994 char *endp;
4995 uint64 timeline;
4996
4998
4999 errno = 0;
5000 timeline = strtou64(*newval, &endp, 0);
5001
5002 if (*endp != '\0' || errno == EINVAL || errno == ERANGE)
5003 {
5004 GUC_check_errdetail("\"%s\" is not a valid number.",
5005 "recovery_target_timeline");
5006 return false;
5007 }
5008
5010 {
5011 GUC_check_errdetail("\"%s\" must be between %u and %u.",
5012 "recovery_target_timeline", 1, PG_UINT32_MAX);
5013 return false;
5014 }
5015 }
5016
5018 if (!myextra)
5019 return false;
5020 *myextra = rttg;
5021 *extra = myextra;
5022
5023 return true;
5024}
#define PG_UINT32_MAX
Definition c.h:674
uint64_t uint64
Definition c.h:625
@ RECOVERY_TARGET_TIMELINE_CONTROLFILE
@ RECOVERY_TARGET_TIMELINE_LATEST

References fb(), GUC_check_errdetail, guc_malloc(), LOG, newval, PG_UINT32_MAX, 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 
)
extern

Definition at line 5043 of file xlogrecovery.c.

5044{
5045 if (strcmp(*newval, "") != 0)
5046 {
5047 TransactionId xid;
5049 char *endp;
5050 char *val;
5051
5052 errno = 0;
5053
5054 /*
5055 * Consume leading whitespace to determine if number is negative
5056 */
5057 val = *newval;
5058
5059 while (isspace((unsigned char) *val))
5060 val++;
5061
5062 /*
5063 * This cast will remove the epoch, if any
5064 */
5065 xid = (TransactionId) strtou64(val, &endp, 0);
5066
5067 if (*endp != '\0' || errno == EINVAL || errno == ERANGE || *val == '-')
5068 {
5069 GUC_check_errdetail("\"%s\" is not a valid number.",
5070 "recovery_target_xid");
5071 return false;
5072 }
5073
5074 if (xid < FirstNormalTransactionId)
5075 {
5076 GUC_check_errdetail("\"%s\" without epoch must be greater than or equal to %u.",
5077 "recovery_target_xid",
5079 return false;
5080 }
5081
5083 if (!myextra)
5084 return false;
5085 *myextra = xid;
5086 *extra = myextra;
5087 }
5088 return true;
5089}
long val
Definition informix.c:689
#define FirstNormalTransactionId
Definition transam.h:34

References fb(), FirstNormalTransactionId, GUC_check_errdetail, guc_malloc(), LOG, newval, and val.

◆ check_restrict_nonsystem_relation_kind()

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

Definition at line 3683 of file postgres.c.

3684{
3685 char *rawstring;
3686 List *elemlist;
3687 ListCell *l;
3688 int flags = 0;
3689
3690 /* Need a modifiable copy of string */
3692
3694 {
3695 /* syntax error in list */
3696 GUC_check_errdetail("List syntax is invalid.");
3699 return false;
3700 }
3701
3702 foreach(l, elemlist)
3703 {
3704 char *tok = (char *) lfirst(l);
3705
3706 if (pg_strcasecmp(tok, "view") == 0)
3707 flags |= RESTRICT_RELKIND_VIEW;
3708 else if (pg_strcasecmp(tok, "foreign-table") == 0)
3710 else
3711 {
3712 GUC_check_errdetail("Unrecognized key word: \"%s\".", tok);
3715 return false;
3716 }
3717 }
3718
3721
3722 /* Save the flags in *extra, for use by the assign function */
3723 *extra = guc_malloc(LOG, sizeof(int));
3724 if (!*extra)
3725 return false;
3726 *((int *) *extra) = flags;
3727
3728 return true;
3729}
#define RESTRICT_RELKIND_FOREIGN_TABLE
Definition tcopprot.h:45
#define RESTRICT_RELKIND_VIEW
Definition tcopprot.h:44

References fb(), GUC_check_errdetail, guc_malloc(), lfirst, list_free(), LOG, 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 
)
extern

Definition at line 933 of file variable.c.

934{
936 Oid roleid;
937 bool is_superuser;
940
941 if (strcmp(*newval, "none") == 0)
942 {
943 /* hardwired translation */
944 roleid = InvalidOid;
945 is_superuser = false;
946 }
948 {
949 /*
950 * In parallel worker initialization, we want to copy the leader's
951 * state even if it no longer matches the catalogs. ParallelWorkerMain
952 * already installed the correct role OID and superuser state.
953 */
954 roleid = GetCurrentRoleId();
956 }
957 else
958 {
959 if (!IsTransactionState())
960 {
961 /*
962 * Can't do catalog lookups, so fail. The result of this is that
963 * role cannot be set in postgresql.conf, which seems like a good
964 * thing anyway, so we don't work hard to avoid it.
965 */
966 return false;
967 }
968
969 /*
970 * When source == PGC_S_TEST, we don't throw a hard error for a
971 * nonexistent user name or insufficient privileges, only a NOTICE.
972 * See comments in guc.h.
973 */
974
975 /* Look up the username */
978 {
979 if (source == PGC_S_TEST)
980 {
983 errmsg("role \"%s\" does not exist", *newval)));
984 return true;
985 }
986 GUC_check_errmsg("role \"%s\" does not exist", *newval);
987 return false;
988 }
989
991 roleid = roleform->oid;
992 is_superuser = roleform->rolsuper;
993
995
996 /* Verify that session user is allowed to become this role */
998 {
999 if (source == PGC_S_TEST)
1000 {
1003 errmsg("permission will be denied to set role \"%s\"",
1004 *newval)));
1005 return true;
1006 }
1008 GUC_check_errmsg("permission denied to set role \"%s\"",
1009 *newval);
1010 return false;
1011 }
1012 }
1013
1014 /* Set up "extra" struct for assign_role to use */
1016 if (!myextra)
1017 return false;
1018 myextra->roleid = roleid;
1019 myextra->is_superuser = is_superuser;
1020 *extra = myextra;
1021
1022 return true;
1023}
bool member_can_set_role(Oid member, Oid role)
Definition acl.c:5348
bool is_superuser(void)
Definition common.c:2480
bool current_role_is_superuser
Definition guc_tables.c:565
Oid GetSessionUserId(void)
Definition miscinit.c:509
Oid GetCurrentRoleId(void)
Definition miscinit.c:937
END_CATALOG_STRUCT typedef FormData_pg_authid * Form_pg_authid
Definition pg_authid.h:60
static Datum PointerGetDatum(const void *X)
Definition postgres.h:342

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

◆ check_search_path()

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

Definition at line 4729 of file namespace.c.

4730{
4731 Oid roleid = InvalidOid;
4732 const char *searchPath = *newval;
4733 char *rawname;
4734 List *namelist;
4736
4737 /*
4738 * We used to try to check that the named schemas exist, but there are
4739 * many valid use-cases for having search_path settings that include
4740 * schemas that don't exist; and often, we are not inside a transaction
4741 * here and so can't consult the system catalogs anyway. So now, the only
4742 * requirement is syntactic validity of the identifier list.
4743 *
4744 * Checking only the syntactic validity also allows us to use the search
4745 * path cache (if available) to avoid calling SplitIdentifierString() on
4746 * the same string repeatedly.
4747 */
4748 if (use_cache)
4749 {
4750 spcache_init();
4751
4752 roleid = GetUserId();
4753
4754 if (spcache_lookup(searchPath, roleid) != NULL)
4755 return true;
4756 }
4757
4758 /*
4759 * Ensure validity check succeeds before creating cache entry.
4760 */
4761
4762 rawname = pstrdup(searchPath); /* need a modifiable copy */
4763
4764 /* Parse string into list of identifiers */
4766 {
4767 /* syntax error in name list */
4768 GUC_check_errdetail("List syntax is invalid.");
4769 pfree(rawname);
4771 return false;
4772 }
4773 pfree(rawname);
4775
4776 /* OK to create empty cache entry */
4777 if (use_cache)
4778 (void) spcache_insert(searchPath, roleid);
4779
4780 return true;
4781}
Oid GetUserId(void)
Definition miscinit.c:470
static SearchPathCacheEntry * spcache_lookup(const char *searchPath, Oid roleid)
Definition namespace.c:345
static MemoryContext SearchPathCacheContext
Definition namespace.c:165
static SearchPathCacheEntry * spcache_insert(const char *searchPath, Oid roleid)
Definition namespace.c:375
static void spcache_init(void)
Definition namespace.c:307

References fb(), 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 
)
extern

Definition at line 828 of file predicate.c.

829{
830 return check_slru_buffers("serializable_buffers", newval);
831}

References check_slru_buffers(), and newval.

◆ check_session_authorization()

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

Definition at line 815 of file variable.c.

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

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

◆ check_ssl()

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

Definition at line 1249 of file variable.c.

1250{
1251#ifndef USE_SSL
1252 if (*newval)
1253 {
1254 GUC_check_errmsg("SSL is not supported by this build");
1255 return false;
1256 }
1257#endif
1258 return true;
1259}

References GUC_check_errmsg, and newval.

◆ check_ssl_sni()

bool check_ssl_sni ( bool newval,
void **  extra,
GucSource  source 
)
extern

Definition at line 1262 of file variable.c.

1263{
1264#ifndef USE_SSL
1265 if (*newval)
1266 {
1267 GUC_check_errmsg("SSL is not supported by this build");
1268 return false;
1269 }
1270#else
1271#ifndef HAVE_SSL_CTX_SET_CLIENT_HELLO_CB
1272 if (*newval)
1273 {
1274 GUC_check_errmsg("SNI requires OpenSSL 1.1.1 or later");
1275 return false;
1276 }
1277#endif
1278#endif
1279 return true;
1280}

References GUC_check_errmsg, and newval.

◆ check_stage_log_stats()

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

Definition at line 3635 of file postgres.c.

3636{
3638 {
3639 GUC_check_errdetail("Cannot enable parameter when \"log_statement_stats\" is true.");
3640 return false;
3641 }
3642 return true;
3643}
bool log_statement_stats
Definition guc_tables.c:551

References GUC_check_errdetail, log_statement_stats, and newval.

◆ check_standard_conforming_strings()

bool check_standard_conforming_strings ( bool newval,
void **  extra,
GucSource  source 
)
extern

Definition at line 1283 of file variable.c.

1284{
1285 if (!*newval)
1286 {
1287 /* check the GUC's definition for an explanation */
1289 GUC_check_errmsg("non-standard string literals are not supported");
1290
1291 return false;
1292 }
1293
1294 return true;
1295}

References fb(), GUC_check_errcode(), GUC_check_errmsg, and newval.

◆ check_subtrans_buffers()

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

Definition at line 272 of file subtrans.c.

273{
274 return check_slru_buffers("subtransaction_buffers", newval);
275}

References check_slru_buffers(), and newval.

◆ check_synchronized_standby_slots()

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

Definition at line 3009 of file slot.c.

3010{
3011 char *rawname;
3012 char *ptr;
3013 List *elemlist;
3014 int size;
3015 bool ok;
3017
3018 if ((*newval)[0] == '\0')
3019 return true;
3020
3021 /* Need a modifiable copy of the GUC string */
3023
3024 /* Now verify if the specified slots exist and have correct type */
3026
3027 if (!ok || elemlist == NIL)
3028 {
3029 pfree(rawname);
3031 return ok;
3032 }
3033
3034 /* Compute the size required for the SyncStandbySlotsConfigData struct */
3035 size = offsetof(SyncStandbySlotsConfigData, slot_names);
3036 foreach_ptr(char, slot_name, elemlist)
3037 size += strlen(slot_name) + 1;
3038
3039 /* GUC extra value must be guc_malloc'd, not palloc'd */
3040 config = (SyncStandbySlotsConfigData *) guc_malloc(LOG, size);
3041 if (!config)
3042 return false;
3043
3044 /* Transform the data into SyncStandbySlotsConfigData */
3045 config->nslotnames = list_length(elemlist);
3046
3047 ptr = config->slot_names;
3048 foreach_ptr(char, slot_name, elemlist)
3049 {
3050 strcpy(ptr, slot_name);
3051 ptr += strlen(slot_name) + 1;
3052 }
3053
3054 *extra = config;
3055
3056 pfree(rawname);
3058 return true;
3059}
static int list_length(const List *l)
Definition pg_list.h:152
static bool validate_sync_standby_slots(char *rawname, List **elemlist)
Definition slot.c:2975
char slot_names[FLEXIBLE_ARRAY_MEMBER]
Definition slot.c:103

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

◆ check_synchronous_standby_names()

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

Definition at line 1070 of file syncrep.c.

1071{
1072 if (*newval != NULL && (*newval)[0] != '\0')
1073 {
1074 yyscan_t scanner;
1075 int parse_rc;
1077
1078 /* Result of parsing is returned in one of these two variables */
1081
1082 /* Parse the synchronous_standby_names string */
1083 syncrep_scanner_init(*newval, &scanner);
1085 syncrep_scanner_finish(scanner);
1086
1087 if (parse_rc != 0 || syncrep_parse_result == NULL)
1088 {
1092 else
1093 /* translator: %s is a GUC name */
1094 GUC_check_errdetail("\"%s\" parser failed.",
1095 "synchronous_standby_names");
1096 return false;
1097 }
1098
1099 if (syncrep_parse_result->num_sync <= 0)
1100 {
1101 GUC_check_errmsg("number of synchronous standbys (%d) must be greater than zero",
1102 syncrep_parse_result->num_sync);
1103 return false;
1104 }
1105
1106 /* GUC extra value must be guc_malloc'd, not palloc'd */
1108 guc_malloc(LOG, syncrep_parse_result->config_size);
1109 if (pconf == NULL)
1110 return false;
1112
1113 *extra = pconf;
1114
1115 /*
1116 * We need not explicitly clean up syncrep_parse_result. It, and any
1117 * other cruft generated during parsing, will be freed when the
1118 * current memory context is deleted. (This code is generally run in
1119 * a short-lived context used for config file processing, so that will
1120 * not be very long.)
1121 */
1122 }
1123 else
1124 *extra = NULL;
1125
1126 return true;
1127}
void * yyscan_t
Definition cubedata.h:65
int syncrep_yyparse(SyncRepConfigData **syncrep_parse_result_p, char **syncrep_parse_error_msg_p, yyscan_t yyscanner)
void syncrep_scanner_finish(yyscan_t yyscanner)
void syncrep_scanner_init(const char *str, yyscan_t *yyscannerp)

References fb(), GUC_check_errcode(), GUC_check_errdetail, GUC_check_errmsg, guc_malloc(), LOG, memcpy(), newval, syncrep_scanner_finish(), syncrep_scanner_init(), and syncrep_yyparse().

◆ check_temp_buffers()

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

Definition at line 893 of file localbuf.c.

894{
895 /*
896 * Once local buffers have been initialized, it's too late to change this.
897 * However, if this is only a test call, allow it.
898 */
900 {
901 GUC_check_errdetail("\"temp_buffers\" cannot be changed after any temporary tables have been accessed in the session.");
902 return false;
903 }
904 return true;
905}
int NLocBuffer
Definition localbuf.c:45

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

◆ check_temp_tablespaces()

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

Definition at line 1212 of file tablespace.c.

1213{
1214 char *rawname;
1215 List *namelist;
1216
1217 /* Need a modifiable copy of string */
1219
1220 /* Parse string into list of identifiers */
1222 {
1223 /* syntax error in name list */
1224 GUC_check_errdetail("List syntax is invalid.");
1225 pfree(rawname);
1227 return false;
1228 }
1229
1230 /*
1231 * If we aren't inside a transaction, or connected to a database, we
1232 * cannot do the catalog accesses necessary to verify the name. Must
1233 * accept the value on faith. Fortunately, there's then also no need to
1234 * pass the data to fd.c.
1235 */
1237 {
1239 Oid *tblSpcs;
1240 int numSpcs;
1241 ListCell *l;
1242
1243 /* temporary workspace until we are done verifying the list */
1244 tblSpcs = (Oid *) palloc(list_length(namelist) * sizeof(Oid));
1245 numSpcs = 0;
1246 foreach(l, namelist)
1247 {
1248 char *curname = (char *) lfirst(l);
1249 Oid curoid;
1251
1252 /* Allow an empty string (signifying database default) */
1253 if (curname[0] == '\0')
1254 {
1255 /* InvalidOid signifies database's default tablespace */
1256 tblSpcs[numSpcs++] = InvalidOid;
1257 continue;
1258 }
1259
1260 /*
1261 * In an interactive SET command, we ereport for bad info. When
1262 * source == PGC_S_TEST, don't throw a hard error for a
1263 * nonexistent tablespace, only a NOTICE. See comments in guc.h.
1264 */
1266 if (curoid == InvalidOid)
1267 {
1268 if (source == PGC_S_TEST)
1271 errmsg("tablespace \"%s\" does not exist",
1272 curname)));
1273 continue;
1274 }
1275
1276 /*
1277 * Allow explicit specification of database's default tablespace
1278 * in temp_tablespaces without triggering permissions checks.
1279 */
1281 {
1282 /* InvalidOid signifies database's default tablespace */
1283 tblSpcs[numSpcs++] = InvalidOid;
1284 continue;
1285 }
1286
1287 /* Check permissions, similarly complaining only if interactive */
1289 ACL_CREATE);
1290 if (aclresult != ACLCHECK_OK)
1291 {
1294 continue;
1295 }
1296
1297 tblSpcs[numSpcs++] = curoid;
1298 }
1299
1300 /* Now prepare an "extra" struct for assign_temp_tablespaces */
1302 numSpcs * sizeof(Oid));
1303 if (!myextra)
1304 return false;
1305 myextra->numSpcs = numSpcs;
1306 memcpy(myextra->tblSpcs, tblSpcs, numSpcs * sizeof(Oid));
1307 *extra = myextra;
1308
1309 pfree(tblSpcs);
1310 }
1311
1312 pfree(rawname);
1314
1315 return true;
1316}
AclResult
Definition acl.h:183
@ ACLCHECK_OK
Definition acl.h:184
void aclcheck_error(AclResult aclerr, ObjectType objtype, const char *objectname)
Definition aclchk.c:2672
AclResult object_aclcheck(Oid classid, Oid objectid, Oid roleid, AclMode mode)
Definition aclchk.c:3879
Oid MyDatabaseTableSpace
Definition globals.c:98
void * palloc(Size size)
Definition mcxt.c:1387
@ OBJECT_TABLESPACE
#define ACL_CREATE
Definition parsenodes.h:85

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

◆ check_timezone()

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

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;
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.");
309 return false;
310 }
311 if (interval->day != 0)
312 {
313 GUC_check_errdetail("Cannot specify days in time zone 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
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 */
342
343 if (!new_tz)
344 {
345 /* Doesn't seem to be any great value in errdetail here */
346 return false;
347 }
348
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:884
#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:688
pg_tz * pg_tzset_offset(long gmtoffset)
Definition pgtz.c:320
static Datum CStringGetDatum(const char *X)
Definition postgres.h:370
static Datum Int32GetDatum(int32 X)
Definition postgres.h:212
static Interval * DatumGetIntervalP(Datum X)
Definition timestamp.h:40

References CStringGetDatum(), DatumGetIntervalP(), DirectFunctionCall3, fb(), 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 
)
extern

Definition at line 487 of file variable.c.

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

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

◆ check_timing_clock_source()

bool check_timing_clock_source ( int newval,
void **  extra,
GucSource  source 
)
extern

Definition at line 379 of file instrument.c.

380{
381 /*
382 * Do nothing if timing is not initialized. This is only expected on child
383 * processes in EXEC_BACKEND builds, as GUC hooks can be called during
384 * InitializeGUCOptions() before InitProcessGlobals() has had a chance to
385 * run pg_initialize_timing(). Instead, TSC will be initialized via
386 * restore_backend_variables.
387 */
388#ifdef EXEC_BACKEND
390 return true;
391#else
393#endif
394
395#if PG_INSTR_TSC_CLOCK
397
399 {
400 GUC_check_errdetail("TSC is not supported as timing clock source");
401 return false;
402 }
403#endif
404
405 return true;
406}
int32 timing_tsc_frequency_khz
Definition instr_time.c:67

References Assert, fb(), GUC_check_errdetail, newval, timing_initialized, and timing_tsc_frequency_khz.

◆ check_transaction_buffers()

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

Definition at line 839 of file clog.c.

840{
841 return check_slru_buffers("transaction_buffers", newval);
842}

References check_slru_buffers(), and newval.

◆ check_transaction_deferrable()

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

Definition at line 624 of file variable.c.

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

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

◆ check_transaction_isolation()

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

Definition at line 586 of file variable.c.

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

References fb(), 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 
)
extern

Definition at line 546 of file variable.c.

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

References fb(), 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 
)
extern

Definition at line 140 of file vacuum.c.

142{
143 /* Value upper and lower hard limits are inclusive */
144 if (*newval == 0 || (*newval >= MIN_BAS_VAC_RING_SIZE_KB &&
146 return true;
147
148 /* Value does not fall within any allowable range */
149 GUC_check_errdetail("\"%s\" must be 0 or between %d kB and %d kB.",
150 "vacuum_buffer_usage_limit",
152
153 return false;
154}
#define MIN_BAS_VAC_RING_SIZE_KB
Definition miscadmin.h:281
#define MAX_BAS_VAC_RING_SIZE_KB
Definition miscadmin.h:282

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 
)
extern

Definition at line 5039 of file xlog.c.

5040{
5041 /*
5042 * -1 indicates a request for auto-tune.
5043 */
5044 if (*newval == -1)
5045 {
5046 /*
5047 * If we haven't yet changed the boot_val default of -1, just let it
5048 * be. We'll fix it when XLOGShmemSize is called.
5049 */
5050 if (XLOGbuffers == -1)
5051 return true;
5052
5053 /* Otherwise, substitute the auto-tune value */
5055 }
5056
5057 /*
5058 * We clamp manually-set values to at least 4 blocks. Prior to PostgreSQL
5059 * 9.1, a minimum of 4 was enforced by guc.c, but since that is no longer
5060 * the case, we just silently treat such values as a request for the
5061 * minimum. (We could throw an error instead, but that doesn't seem very
5062 * helpful.)
5063 */
5064 if (*newval < 4)
5065 *newval = 4;
5066
5067 return true;
5068}
static int XLOGChooseNumBuffers(void)
Definition xlog.c:5023
int XLOGbuffers
Definition xlog.c:124

References newval, XLOGbuffers, and XLOGChooseNumBuffers().

◆ check_wal_consistency_checking()

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

Definition at line 5074 of file xlog.c.

5075{
5076 char *rawstring;
5077 List *elemlist;
5078 ListCell *l;
5079 bool newwalconsistency[RM_MAX_ID + 1];
5080
5081 /* Initialize the array */
5082 MemSet(newwalconsistency, 0, (RM_MAX_ID + 1) * sizeof(bool));
5083
5084 /* Need a modifiable copy of string */
5086
5087 /* Parse string into list of identifiers */
5089 {
5090 /* syntax error in list */
5091 GUC_check_errdetail("List syntax is invalid.");
5094 return false;
5095 }
5096
5097 foreach(l, elemlist)
5098 {
5099 char *tok = (char *) lfirst(l);
5100 int rmid;
5101
5102 /* Check for 'all'. */
5103 if (pg_strcasecmp(tok, "all") == 0)
5104 {
5105 for (rmid = 0; rmid <= RM_MAX_ID; rmid++)
5106 if (RmgrIdExists(rmid) && GetRmgr(rmid).rm_mask != NULL)
5107 newwalconsistency[rmid] = true;
5108 }
5109 else
5110 {
5111 /* Check if the token matches any known resource manager. */
5112 bool found = false;
5113
5114 for (rmid = 0; rmid <= RM_MAX_ID; rmid++)
5115 {
5116 if (RmgrIdExists(rmid) && GetRmgr(rmid).rm_mask != NULL &&
5117 pg_strcasecmp(tok, GetRmgr(rmid).rm_name) == 0)
5118 {
5119 newwalconsistency[rmid] = true;
5120 found = true;
5121 break;
5122 }
5123 }
5124 if (!found)
5125 {
5126 /*
5127 * During startup, it might be a not-yet-loaded custom
5128 * resource manager. Defer checking until
5129 * InitializeWalConsistencyChecking().
5130 */
5132 {
5134 }
5135 else
5136 {
5137 GUC_check_errdetail("Unrecognized key word: \"%s\".", tok);
5140 return false;
5141 }
5142 }
5143 }
5144 }
5145
5148
5149 /* assign new value */
5150 *extra = guc_malloc(LOG, (RM_MAX_ID + 1) * sizeof(bool));
5151 if (!*extra)
5152 return false;
5153 memcpy(*extra, newwalconsistency, (RM_MAX_ID + 1) * sizeof(bool));
5154 return true;
5155}
#define MemSet(start, val, len)
Definition c.h:1107
bool process_shared_preload_libraries_done
Definition miscinit.c:1789
#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:173
static RmgrData GetRmgr(RmgrId rmid)
static bool RmgrIdExists(RmgrId rmid)

References check_wal_consistency_checking_deferred, fb(), GetRmgr(), GUC_check_errdetail, guc_malloc(), lfirst, list_free(), LOG, memcpy(), 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 
)
extern

Definition at line 2235 of file xlog.c.

2236{
2238 {
2239 GUC_check_errdetail("The WAL segment size must be a power of two between 1 MB and 1 GB.");
2240 return false;
2241 }
2242
2243 return true;
2244}
#define IsValidWalSegSize(size)

References GUC_check_errdetail, IsValidWalSegSize, and newval.

◆ show_archive_command()

const char * show_archive_command ( void  )
extern

Definition at line 5214 of file xlog.c.

5215{
5216 if (XLogArchivingActive())
5217 return XLogArchiveCommand;
5218 else
5219 return "(disabled)";
5220}
char * XLogArchiveCommand
Definition xlog.c:127
#define XLogArchivingActive()
Definition xlog.h:102

References XLogArchiveCommand, and XLogArchivingActive.

◆ show_data_directory_mode()

const char * show_data_directory_mode ( void  )
extern

Definition at line 1182 of file variable.c.

1183{
1184 static char buf[12];
1185
1186 snprintf(buf, sizeof(buf), "%04o", data_directory_mode);
1187 return buf;
1188}
int data_directory_mode
Definition globals.c:79
#define snprintf
Definition port.h:260

References buf, data_directory_mode, and snprintf.

◆ show_effective_wal_level()

const char * show_effective_wal_level ( void  )
extern

Definition at line 5241 of file xlog.c.

5242{
5244 return "minimal";
5245
5246 /*
5247 * During recovery, effective_wal_level reflects the primary's
5248 * configuration rather than the local wal_level value.
5249 */
5250 if (RecoveryInProgress())
5251 return IsXLogLogicalInfoEnabled() ? "logical" : "replica";
5252
5253 return XLogLogicalInfoActive() ? "logical" : "replica";
5254}
bool IsXLogLogicalInfoEnabled(void)
Definition logicalctl.c:218
int wal_level
Definition xlog.c:138
#define XLogLogicalInfoActive()
Definition xlog.h:137
@ WAL_LEVEL_MINIMAL
Definition xlog.h:76

References IsXLogLogicalInfoEnabled(), RecoveryInProgress(), wal_level, WAL_LEVEL_MINIMAL, and XLogLogicalInfoActive.

◆ show_in_hot_standby()

const char * show_in_hot_standby ( void  )
extern

Definition at line 5226 of file xlog.c.

5227{
5228 /*
5229 * We display the actual state based on shared memory, so that this GUC
5230 * reports up-to-date state if examined intra-query. The underlying
5231 * variable (in_hot_standby_guc) changes only when we transmit a new value
5232 * to the client.
5233 */
5234 return RecoveryInProgress() ? "on" : "off";
5235}

References RecoveryInProgress().

◆ show_log_file_mode()

const char * show_log_file_mode ( void  )
extern

Definition at line 1194 of file variable.c.

1195{
1196 static char buf[12];
1197
1198 snprintf(buf, sizeof(buf), "%04o", Log_file_mode);
1199 return buf;
1200}
int Log_file_mode
Definition syslogger.c:77

References buf, Log_file_mode, and snprintf.

◆ show_log_timezone()

const char * show_log_timezone ( void  )
extern

Definition at line 465 of file variable.c.

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

References fb(), log_timezone, and pg_get_timezone_name().

◆ show_random_seed()

const char * show_random_seed ( void  )
extern

Definition at line 677 of file variable.c.

678{
679 return "unavailable";
680}

◆ show_role()

const char * show_role ( void  )
extern

Definition at line 1034 of file variable.c.

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

References GetCurrentRoleId(), OidIsValid, and role_string.

◆ show_tcp_keepalives_count()

const char * show_tcp_keepalives_count ( void  )
extern

Definition at line 2021 of file pqcomm.c.

2022{
2023 /* See comments in assign_tcp_keepalives_idle */
2024 static char nbuf[16];
2025
2027 return nbuf;
2028}
int pq_getkeepalivescount(Port *port)
Definition pqcomm.c:1802

References fb(), MyProcPort, pq_getkeepalivescount(), and snprintf.

◆ show_tcp_keepalives_idle()

const char * show_tcp_keepalives_idle ( void  )
extern

Definition at line 1975 of file pqcomm.c.

1976{
1977 /* See comments in assign_tcp_keepalives_idle */
1978 static char nbuf[16];
1979
1981 return nbuf;
1982}
int pq_getkeepalivesidle(Port *port)
Definition pqcomm.c:1633

References fb(), MyProcPort, pq_getkeepalivesidle(), and snprintf.

◆ show_tcp_keepalives_interval()

const char * show_tcp_keepalives_interval ( void  )
extern

Definition at line 1998 of file pqcomm.c.

1999{
2000 /* See comments in assign_tcp_keepalives_idle */
2001 static char nbuf[16];
2002
2004 return nbuf;
2005}
int pq_getkeepalivesinterval(Port *port)
Definition pqcomm.c:1718

References fb(), MyProcPort, pq_getkeepalivesinterval(), and snprintf.

◆ show_tcp_user_timeout()

const char * show_tcp_user_timeout ( void  )
extern

Definition at line 2044 of file pqcomm.c.

2045{
2046 /* See comments in assign_tcp_keepalives_idle */
2047 static char nbuf[16];
2048
2050 return nbuf;
2051}
int pq_gettcpusertimeout(Port *port)
Definition pqcomm.c:1877

References fb(), MyProcPort, pq_gettcpusertimeout(), and snprintf.

◆ show_timezone()

const char * show_timezone ( void  )
extern

Definition at line 392 of file variable.c.

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

References fb(), pg_get_timezone_name(), and session_timezone.

◆ show_timing_clock_source()

const char * show_timing_clock_source ( void  )
extern

Definition at line 426 of file instrument.c.

427{
428 switch (timing_clock_source)
429 {
431#if PG_INSTR_TSC_CLOCK
433 return "auto (tsc)";
434#endif
435 return "auto (system)";
437 return "system";
438#if PG_INSTR_TSC_CLOCK
440 return "tsc";
441#endif
442 }
443
444 /* unreachable */
445 return "?";
446}
int timing_clock_source
Definition instr_time.c:64
static TimingClockSourceType pg_current_timing_clock_source(void)
Definition instr_time.h:178
@ TIMING_CLOCK_SOURCE_SYSTEM
Definition instr_time.h:126
@ TIMING_CLOCK_SOURCE_AUTO
Definition instr_time.h:125

References fb(), pg_current_timing_clock_source(), timing_clock_source, TIMING_CLOCK_SOURCE_AUTO, and TIMING_CLOCK_SOURCE_SYSTEM.

◆ show_unix_socket_permissions()

const char * show_unix_socket_permissions ( void  )
extern

Definition at line 1206 of file variable.c.

1207{
1208 static char buf[12];
1209
1210 snprintf(buf, sizeof(buf), "%04o", Unix_socket_permissions);
1211 return buf;
1212}
int Unix_socket_permissions
Definition pqcomm.c:107

References buf, snprintf, and Unix_socket_permissions.