PostgreSQL Source Code git master
|
#include "nodes/params.h"
#include "nodes/plannodes.h"
#include "storage/procsignal.h"
#include "utils/guc.h"
#include "utils/queryenvironment.h"
Go to the source code of this file.
Macros | |
#define | RESTRICT_RELKIND_VIEW 0x01 |
#define | RESTRICT_RELKIND_FOREIGN_TABLE 0x02 |
Enumerations | |
enum | LogStmtLevel { LOGSTMT_NONE , LOGSTMT_DDL , LOGSTMT_MOD , LOGSTMT_ALL } |
Functions | |
List * | pg_parse_query (const char *query_string) |
List * | pg_rewrite_query (Query *query) |
List * | pg_analyze_and_rewrite_fixedparams (RawStmt *parsetree, const char *query_string, const Oid *paramTypes, int numParams, QueryEnvironment *queryEnv) |
List * | pg_analyze_and_rewrite_varparams (RawStmt *parsetree, const char *query_string, Oid **paramTypes, int *numParams, QueryEnvironment *queryEnv) |
List * | pg_analyze_and_rewrite_withcb (RawStmt *parsetree, const char *query_string, ParserSetupHook parserSetup, void *parserSetupArg, QueryEnvironment *queryEnv) |
PlannedStmt * | pg_plan_query (Query *querytree, const char *query_string, int cursorOptions, ParamListInfo boundParams) |
List * | pg_plan_queries (List *querytrees, const char *query_string, int cursorOptions, ParamListInfo boundParams) |
void | die (SIGNAL_ARGS) |
pg_noreturn void | quickdie (SIGNAL_ARGS) |
void | StatementCancelHandler (SIGNAL_ARGS) |
pg_noreturn void | FloatExceptionHandler (SIGNAL_ARGS) |
void | HandleRecoveryConflictInterrupt (ProcSignalReason reason) |
void | ProcessClientReadInterrupt (bool blocked) |
void | ProcessClientWriteInterrupt (bool blocked) |
void | process_postgres_switches (int argc, char *argv[], GucContext ctx, const char **dbname) |
pg_noreturn void | PostgresSingleUserMain (int argc, char *argv[], const char *username) |
pg_noreturn void | PostgresMain (const char *dbname, const char *username) |
void | ResetUsage (void) |
void | ShowUsage (const char *title) |
int | check_log_duration (char *msec_str, bool was_logged) |
void | set_debug_options (int debug_flag, GucContext context, GucSource source) |
bool | set_plan_disabling_options (const char *arg, GucContext context, GucSource source) |
const char * | get_stats_option_name (const char *arg) |
Variables | |
PGDLLIMPORT CommandDest | whereToSendOutput |
PGDLLIMPORT const char * | debug_query_string |
PGDLLIMPORT int | PostAuthDelay |
PGDLLIMPORT int | client_connection_check_interval |
PGDLLIMPORT bool | Log_disconnections |
PGDLLIMPORT int | log_statement |
PGDLLIMPORT int | restrict_nonsystem_relation_kind |
#define RESTRICT_RELKIND_FOREIGN_TABLE 0x02 |
Definition at line 44 of file tcopprot.h.
#define RESTRICT_RELKIND_VIEW 0x01 |
Definition at line 43 of file tcopprot.h.
enum LogStmtLevel |
Enumerator | |
---|---|
LOGSTMT_NONE | |
LOGSTMT_DDL | |
LOGSTMT_MOD | |
LOGSTMT_ALL |
Definition at line 31 of file tcopprot.h.
int check_log_duration | ( | char * | msec_str, |
bool | was_logged | ||
) |
Definition at line 2401 of file postgres.c.
References GetCurrentStatementStartTimestamp(), GetCurrentTimestamp(), log_duration, log_min_duration_sample, log_min_duration_statement, log_statement_sample_rate, pg_global_prng_state, pg_prng_double(), snprintf, TimestampDifference(), and xact_is_sampled.
Referenced by exec_bind_message(), exec_execute_message(), exec_parse_message(), exec_simple_query(), and HandleFunctionRequest().
void die | ( | SIGNAL_ARGS | ) |
Definition at line 3004 of file postgres.c.
References DestRemote, DISCONNECT_KILLED, DoingCommandRead, InterruptPending, MyLatch, pgStatSessionEndCause, proc_exit_inprogress, ProcDiePending, ProcessInterrupts(), SetLatch(), and whereToSendOutput.
Referenced by PostgresMain().
pg_noreturn void FloatExceptionHandler | ( | SIGNAL_ARGS | ) |
Definition at line 3051 of file postgres.c.
References ereport, errcode(), errdetail(), errmsg(), and ERROR.
Referenced by AutoVacLauncherMain(), AutoVacWorkerMain(), BackgroundWorkerMain(), plperl_init_interp(), PostgresMain(), and ReplSlotSyncWorkerMain().
const char * get_stats_option_name | ( | const char * | arg | ) |
Definition at line 3722 of file postgres.c.
Referenced by PostmasterMain(), and process_postgres_switches().
void HandleRecoveryConflictInterrupt | ( | ProcSignalReason | reason | ) |
Definition at line 3067 of file postgres.c.
References InterruptPending, RecoveryConflictPending, and RecoveryConflictPendingReasons.
Referenced by procsignal_sigusr1_handler().
List * pg_analyze_and_rewrite_fixedparams | ( | RawStmt * | parsetree, |
const char * | query_string, | ||
const Oid * | paramTypes, | ||
int | numParams, | ||
QueryEnvironment * | queryEnv | ||
) |
Definition at line 665 of file postgres.c.
References log_parser_stats, parse_analyze_fixedparams(), pg_rewrite_query(), ResetUsage(), and ShowUsage().
Referenced by _SPI_execute_plan(), _SPI_prepare_plan(), BeginCopyTo(), exec_simple_query(), execute_sql_string(), and RevalidateCachedQuery().
List * pg_analyze_and_rewrite_varparams | ( | RawStmt * | parsetree, |
const char * | query_string, | ||
Oid ** | paramTypes, | ||
int * | numParams, | ||
QueryEnvironment * | queryEnv | ||
) |
Definition at line 704 of file postgres.c.
References ereport, errcode(), errmsg(), ERROR, i, InvalidOid, log_parser_stats, parse_analyze_varparams(), pg_rewrite_query(), ResetUsage(), and ShowUsage().
Referenced by exec_parse_message(), and PrepareQuery().
List * pg_analyze_and_rewrite_withcb | ( | RawStmt * | parsetree, |
const char * | query_string, | ||
ParserSetupHook | parserSetup, | ||
void * | parserSetupArg, | ||
QueryEnvironment * | queryEnv | ||
) |
Definition at line 758 of file postgres.c.
References log_parser_stats, parse_analyze_withcb(), pg_rewrite_query(), ResetUsage(), and ShowUsage().
Referenced by _SPI_execute_plan(), _SPI_prepare_plan(), fmgr_sql_validator(), init_sql_fcache(), inline_set_returning_function(), and RevalidateCachedQuery().
List * pg_parse_query | ( | const char * | query_string | ) |
Definition at line 603 of file postgres.c.
References copyObject, elog, equal(), log_parser_stats, new_list(), nodeToStringWithLocations(), pfree(), RAW_PARSE_DEFAULT, raw_parser(), ResetUsage(), ShowUsage(), str, and WARNING.
Referenced by exec_parse_message(), exec_simple_query(), execute_sql_string(), fmgr_sql_validator(), ImportForeignSchema(), init_sql_fcache(), inline_function(), and inline_set_returning_function().
List * pg_plan_queries | ( | List * | querytrees, |
const char * | query_string, | ||
int | cursorOptions, | ||
ParamListInfo | boundParams | ||
) |
Definition at line 970 of file postgres.c.
References CMD_UTILITY, Query::commandType, lappend(), lfirst_node, makeNode, NIL, pg_plan_query(), stmt, Query::stmt_location, and Query::utilityStmt.
Referenced by BuildCachedPlan(), exec_simple_query(), execute_sql_string(), and UpdateCachedPlan().
PlannedStmt * pg_plan_query | ( | Query * | querytree, |
const char * | query_string, | ||
int | cursorOptions, | ||
ParamListInfo | boundParams | ||
) |
Definition at line 882 of file postgres.c.
References ActiveSnapshotSet(), Assert(), CMD_UTILITY, copyObject, Debug_pretty_print, Debug_print_plan, elog, elog_node_display(), equal(), LOG, log_planner_stats, nodeToStringWithLocations(), pfree(), plan, planner(), querytree(), ResetUsage(), ShowUsage(), str, and WARNING.
Referenced by BeginCopyTo(), ExecCreateTableAs(), init_execution_state(), PerformCursorOpen(), pg_plan_queries(), refresh_matview_datafill(), and standard_ExplainOneQuery().
Definition at line 798 of file postgres.c.
References CMD_UTILITY, Query::commandType, copyObject, Debug_pretty_print, Debug_print_parse, Debug_print_rewritten, elog, elog_node_display(), equal(), lappend(), lfirst_node, list_make1, LOG, log_parser_stats, new_list(), NIL, nodeToStringWithLocations(), pfree(), QueryRewrite(), ResetUsage(), ShowUsage(), str, and WARNING.
Referenced by fmgr_sql_validator(), init_sql_fcache(), inline_set_returning_function(), pg_analyze_and_rewrite_fixedparams(), pg_analyze_and_rewrite_varparams(), and pg_analyze_and_rewrite_withcb().
pg_noreturn void PostgresMain | ( | const char * | dbname, |
const char * | username | ||
) |
Definition at line 4156 of file postgres.c.
References AbortCurrentTransaction(), ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, am_walsender, Assert(), ConnectionTiming::auth_end, ConnectionTiming::auth_start, BaseInit(), BeginReportingGUCOptions(), buf, CHECK_FOR_INTERRUPTS, ConfigReloadPending, conn_timing, dbname, debug_query_string, DestDebug, DestNone, DestRemote, die(), disable_all_timeouts(), disable_timeout(), DISCONNECT_CLIENT_EOF, doing_extended_query_message, DoingCommandRead, drop_unnamed_stmt(), DropPreparedStatement(), EmitErrorReport(), enable_timeout_after(), EndImplicitTransactionBlock(), ereport, errcode(), errmsg(), ERROR, error_context_stack, EventTriggerOnLogin(), exec_bind_message(), exec_describe_portal_message(), exec_describe_statement_message(), exec_execute_message(), exec_parse_message(), exec_replication_command(), exec_simple_query(), FATAL, finish_xact_command(), FloatExceptionHandler(), FlushErrorState(), forbidden_in_wal_sender(), ConnectionTiming::fork_end, ConnectionTiming::fork_start, get_timeout_active(), GetCurrentTimestamp(), GetPortalByName(), GetProcessingMode, HandleFunctionRequest(), HOLD_INTERRUPTS, i, IDLE_IN_TRANSACTION_SESSION_TIMEOUT, IDLE_SESSION_TIMEOUT, IDLE_STATS_UPDATE_TIMEOUT, IdleInTransactionSessionTimeout, IdleSessionTimeout, ignore_till_sync, INIT_PG_LOAD_SESSION_LIBS, InitializeTimeouts(), InitPostgres(), InitProcessing, initStringInfo(), InitWalSender(), InvalidateCatalogSnapshotConditionally(), InvalidOid, IsAbortedTransactionBlockState(), IsExternalConnectionBackend, IsTransactionOrTransactionBlock(), IsUnderPostmaster, jit_reset_after_error(), LOG, LOG_CONNECTION_SETUP_DURATIONS, log_connections, Log_disconnections, log_disconnections(), MemoryContextDelete(), MemoryContextReset(), MemoryContextSwitchTo(), MessageContext, MyBackendType, MyCancelKey, MyCancelKeyValid, MyDatabaseId, MyProcPid, MyReplicationSlot, NormalProcessing, notifyInterruptPending, NS_PER_US, on_proc_exit(), palloc_array, PG_exception_stack, pg_strong_random(), PGC_SIGHUP, pgstat_report_activity(), pgstat_report_connect(), pgstat_report_stat(), pgStatSessionEndCause, PortalDrop(), PortalErrorCleanup(), PortalIsValid, PostmasterContext, pq_beginmessage(), pq_comm_reset, pq_endmessage(), pq_flush, pq_getmsgbyte(), pq_getmsgend(), pq_getmsgint(), pq_getmsgstring(), pq_is_reading_msg(), pq_putemptymessage(), pq_sendint32(), PqMsg_BackendKeyData, PqMsg_Bind, PqMsg_Close, PqMsg_CloseComplete, PqMsg_CopyData, PqMsg_CopyDone, PqMsg_CopyFail, PqMsg_Describe, PqMsg_Execute, PqMsg_Flush, PqMsg_FunctionCall, PqMsg_Parse, PqMsg_Query, PqMsg_Sync, PqMsg_Terminate, pqsignal, printf, proc_exit(), ProcessConfigFile(), ProcessNotifyInterrupt(), procsignal_sigusr1_handler(), QueryCancelPending, quickdie(), ReadCommand(), ConnectionTiming::ready_for_use, ReadyForQuery(), ReplicationSlotCleanup(), ReplicationSlotRelease(), ReportChangedGUCOptions(), RESUME_INTERRUPTS, row_description_buf, row_description_context, set_ps_display(), SetCurrentStatementStartTimestamp(), SetProcessingMode, SIGCHLD, SIGHUP, SignalHandlerForConfigReload(), SIGPIPE, SIGQUIT, SIGUSR1, SIGUSR2, ConnectionTiming::socket_create, start_xact_command(), STATE_FASTPATH, STATE_IDLE, STATE_IDLEINTRANSACTION, STATE_IDLEINTRANSACTION_ABORTED, StatementCancelHandler(), TIMESTAMP_MINUS_INFINITY, TimestampDifferenceMicroseconds(), TopMemoryContext, TransactionTimeout, UnBlockSig, username, valgrind_report_error_query, WalSndErrorCleanup(), WalSndSignals(), whereToSendOutput, and xact_started.
Referenced by BackendMain(), and PostgresSingleUserMain().
pg_noreturn void PostgresSingleUserMain | ( | int | argc, |
char * | argv[], | ||
const char * | username | ||
) |
Definition at line 4027 of file postgres.c.
References Assert(), ChangeToDataDir(), checkDataDir(), CreateDataDirLockFile(), CreateSharedMemoryAndSemaphores(), dbname, ereport, errcode(), errmsg(), FATAL, GetCurrentTimestamp(), InitializeFastPathLocks(), InitializeGUCOptions(), InitializeMaxBackends(), InitializeShmemGUCs(), InitializeWalConsistencyChecking(), InitPostmasterChildSlots(), InitProcess(), InitStandaloneProcess(), IsUnderPostmaster, LocalProcessControlFile(), PGC_POSTMASTER, PgStartTime, PostgresMain(), proc_exit(), process_postgres_switches(), process_shared_preload_libraries(), process_shmem_requests(), progname, SelectConfigFiles(), set_max_safe_fds(), userDoption, and username.
Referenced by main().
void process_postgres_switches | ( | int | argc, |
char * | argv[], | ||
GucContext | ctx, | ||
const char ** | dbname | ||
) |
Definition at line 3762 of file postgres.c.
References dbname, DISPATCH_POSTMASTER, EchoQuery, ereport, errcode(), errhint(), errmsg(), ERROR, FATAL, flag(), FrontendProtocol, get_stats_option_name(), getopt(), IsBinaryUpgrade, IsUnderPostmaster, MAXPGPATH, name, optarg, opterr, optind, OutputFileName, parse_dispatch_option(), ParseLongOption(), pfree(), PGC_POSTMASTER, PGC_S_ARGV, PGC_S_CLIENT, progname, set_debug_options(), set_plan_disabling_options(), SetConfigOption(), strlcpy(), userDoption, UseSemiNewlineNewline, and value.
Referenced by PostgresSingleUserMain(), and process_startup_options().
void ProcessClientReadInterrupt | ( | bool | blocked | ) |
Definition at line 501 of file postgres.c.
References catchupInterruptPending, CHECK_FOR_INTERRUPTS, DoingCommandRead, MyLatch, notifyInterruptPending, ProcDiePending, ProcessCatchupInterrupt(), ProcessNotifyInterrupt(), and SetLatch().
Referenced by interactive_getc(), and secure_read().
void ProcessClientWriteInterrupt | ( | bool | blocked | ) |
Definition at line 547 of file postgres.c.
References CHECK_FOR_INTERRUPTS, CritSectionCount, DestNone, DestRemote, InterruptHoldoffCount, MyLatch, ProcDiePending, SetLatch(), and whereToSendOutput.
Referenced by secure_write().
pg_noreturn void quickdie | ( | SIGNAL_ARGS | ) |
Definition at line 2907 of file postgres.c.
References BlockSig, ClientAuthInProgress, DestNone, DestRemote, ereport, errcode(), errdetail(), errhint(), errmsg(), error_context_stack, GetQuitSignalReason(), HOLD_INTERRUPTS, PMQUIT_FOR_CRASH, PMQUIT_FOR_STOP, PMQUIT_NOT_SENT, SIGQUIT, WARNING, WARNING_CLIENT_ONLY, and whereToSendOutput.
Referenced by PostgresMain().
void ResetUsage | ( | void | ) |
Definition at line 5019 of file postgres.c.
References getrusage(), gettimeofday(), RUSAGE_SELF, Save_r, and Save_t.
Referenced by _bt_leader_participate_as_worker(), _bt_leafbuild(), _bt_parallel_build_main(), _SPI_pquery(), btbuild(), exec_bind_message(), exec_execute_message(), exec_parse_message(), exec_simple_query(), pg_analyze_and_rewrite_fixedparams(), pg_analyze_and_rewrite_varparams(), pg_analyze_and_rewrite_withcb(), pg_parse_query(), pg_plan_query(), pg_rewrite_query(), PortalRun(), and PortalRunMulti().
void set_debug_options | ( | int | debug_flag, |
GucContext | context, | ||
GucSource | source | ||
) |
Definition at line 3651 of file postgres.c.
References PGC_POSTMASTER, SetConfigOption(), source, and sprintf.
Referenced by PostmasterMain(), and process_postgres_switches().
bool set_plan_disabling_options | ( | const char * | arg, |
GucContext | context, | ||
GucSource | source | ||
) |
Definition at line 3680 of file postgres.c.
References arg, SetConfigOption(), and source.
Referenced by PostmasterMain(), and process_postgres_switches().
void ShowUsage | ( | const char * | title | ) |
Definition at line 5026 of file postgres.c.
References __darwin__, appendStringInfo(), appendStringInfoString(), ereport, errdetail_internal(), errmsg_internal(), getrusage(), gettimeofday(), initStringInfo(), LOG, pfree(), rusage::ru_stime, rusage::ru_utime, RUSAGE_SELF, Save_r, Save_t, str, and user.
Referenced by _bt_leader_participate_as_worker(), _bt_leafbuild(), _bt_parallel_build_main(), _SPI_pquery(), btbuild(), exec_bind_message(), exec_execute_message(), exec_parse_message(), exec_simple_query(), pg_analyze_and_rewrite_fixedparams(), pg_analyze_and_rewrite_varparams(), pg_analyze_and_rewrite_withcb(), pg_parse_query(), pg_plan_query(), pg_rewrite_query(), PortalRun(), and PortalRunMulti().
void StatementCancelHandler | ( | SIGNAL_ARGS | ) |
Definition at line 3034 of file postgres.c.
References InterruptPending, MyLatch, proc_exit_inprogress, QueryCancelPending, and SetLatch().
Referenced by AutoVacLauncherMain(), AutoVacWorkerMain(), BackgroundWorkerMain(), PostgresMain(), and WalSndSignals().
|
extern |
Definition at line 102 of file postgres.c.
Referenced by ProcessInterrupts(), and start_xact_command().
|
extern |
Definition at line 88 of file postgres.c.
Referenced by _brin_begin_parallel(), _brin_parallel_build_main(), _bt_begin_parallel(), _bt_parallel_build_main(), _gin_begin_parallel(), _gin_parallel_build_main(), check_log_of_query(), current_query(), errstart(), exec_bind_message(), exec_execute_message(), exec_parse_message(), exec_replication_command(), exec_simple_query(), initialize_worker_spi(), parallel_vacuum_init(), parallel_vacuum_main(), ParallelQueryMain(), PostgresMain(), proc_exit_prepare(), send_message_to_server_log(), worker_spi_main(), write_csvlog(), and write_jsonlog().
|
extern |
Definition at line 94 of file postgres.c.
Referenced by PostgresMain().
|
extern |
Definition at line 96 of file postgres.c.
Referenced by check_log_statement(), and HandleFunctionRequest().
|
extern |
Definition at line 99 of file postgres.c.
Referenced by AutoVacLauncherMain(), AutoVacWorkerMain(), BackgroundWorkerMain(), and InitPostgres().
|
extern |
Definition at line 105 of file postgres.c.
Referenced by ApplyRetrieveRule(), assign_restrict_nonsystem_relation_kind(), get_relation_info(), GetFdwRoutine(), make_modifytable(), and rewriteTargetView().
|
extern |
Definition at line 91 of file postgres.c.
Referenced by BackendInitialize(), BeginCopyFrom(), BeginCopyTo(), BeginReportingGUCOptions(), die(), DoCopyTo(), errfinish(), exec_bind_message(), exec_describe_portal_message(), exec_describe_statement_message(), exec_execute_message(), exec_parse_message(), exec_simple_query(), NotifyMyFrontEnd(), PostgresMain(), PostmasterMain(), pq_cleanup_redirect_to_shm_mq(), pq_redirect_to_shm_mq(), ProcessClientWriteInterrupt(), ProcessInterrupts(), quickdie(), ReadCommand(), send_message_to_server_log(), should_output_to_client(), SocketBackend(), SyncRepWaitForLSN(), SysLoggerMain(), and WalSndShutdown().