PostgreSQL Source Code  git master
tcopprot.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * tcopprot.h
4  * prototypes for postgres.c.
5  *
6  *
7  * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/tcop/tcopprot.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef TCOPPROT_H
15 #define TCOPPROT_H
16 
17 #include "nodes/params.h"
18 #include "nodes/plannodes.h"
19 #include "storage/procsignal.h"
20 #include "utils/guc.h"
21 #include "utils/queryenvironment.h"
22 
23 
24 /* Required daylight between max_stack_depth and the kernel limit, in bytes */
25 #define STACK_DEPTH_SLOP (512 * 1024L)
26 
28 extern PGDLLIMPORT const char *debug_query_string;
29 extern PGDLLIMPORT int max_stack_depth;
30 extern PGDLLIMPORT int PostAuthDelay;
32 
33 /* GUC-configurable parameters */
34 
35 typedef enum
36 {
37  LOGSTMT_NONE, /* log no statements */
38  LOGSTMT_DDL, /* log data definition statements */
39  LOGSTMT_MOD, /* log modification statements, plus DDL */
40  LOGSTMT_ALL, /* log all statements */
41 } LogStmtLevel;
42 
43 extern PGDLLIMPORT int log_statement;
44 
45 extern List *pg_parse_query(const char *query_string);
46 extern List *pg_rewrite_query(Query *query);
48  const char *query_string,
49  const Oid *paramTypes, int numParams,
50  QueryEnvironment *queryEnv);
52  const char *query_string,
53  Oid **paramTypes,
54  int *numParams,
55  QueryEnvironment *queryEnv);
56 extern List *pg_analyze_and_rewrite_withcb(RawStmt *parsetree,
57  const char *query_string,
58  ParserSetupHook parserSetup,
59  void *parserSetupArg,
60  QueryEnvironment *queryEnv);
61 extern PlannedStmt *pg_plan_query(Query *querytree, const char *query_string,
62  int cursorOptions,
63  ParamListInfo boundParams);
64 extern List *pg_plan_queries(List *querytrees, const char *query_string,
65  int cursorOptions,
66  ParamListInfo boundParams);
67 
68 extern void die(SIGNAL_ARGS);
73 extern void ProcessClientReadInterrupt(bool blocked);
74 extern void ProcessClientWriteInterrupt(bool blocked);
75 
76 extern void process_postgres_switches(int argc, char *argv[],
77  GucContext ctx, const char **dbname);
78 extern void PostgresSingleUserMain(int argc, char *argv[],
79  const char *username) pg_attribute_noreturn();
80 extern void PostgresMain(const char *dbname,
81  const char *username) pg_attribute_noreturn();
82 extern long get_stack_depth_rlimit(void);
83 extern void ResetUsage(void);
84 extern void ShowUsage(const char *title);
85 extern int check_log_duration(char *msec_str, bool was_logged);
86 extern void set_debug_options(int debug_flag,
88 extern bool set_plan_disabling_options(const char *arg,
90 extern const char *get_stats_option_name(const char *arg);
91 
92 #endif /* TCOPPROT_H */
Datum querytree(PG_FUNCTION_ARGS)
Definition: _int_bool.c:666
#define PGDLLIMPORT
Definition: c.h:1316
#define SIGNAL_ARGS
Definition: c.h:1345
#define pg_attribute_noreturn()
Definition: c.h:217
CommandDest
Definition: dest.h:86
GucSource
Definition: guc.h:108
GucContext
Definition: guc.h:68
void(* ParserSetupHook)(struct ParseState *pstate, void *arg)
Definition: params.h:108
void * arg
static rewind_source * source
Definition: pg_rewind.c:89
const char * username
Definition: pgbench.c:296
unsigned int Oid
Definition: postgres_ext.h:31
ProcSignalReason
Definition: procsignal.h:31
tree context
Definition: radixtree.h:1835
char * dbname
Definition: streamutil.c:52
Definition: pg_list.h:54
List * pg_parse_query(const char *query_string)
Definition: postgres.c:611
void process_postgres_switches(int argc, char *argv[], GucContext ctx, const char **dbname)
Definition: postgres.c:3790
PGDLLIMPORT int PostAuthDelay
Definition: postgres.c:101
void FloatExceptionHandler(SIGNAL_ARGS) pg_attribute_noreturn()
Definition: postgres.c:3019
void set_debug_options(int debug_flag, GucContext context, GucSource source)
Definition: postgres.c:3679
PGDLLIMPORT const char * debug_query_string
Definition: postgres.c:87
void StatementCancelHandler(SIGNAL_ARGS)
Definition: postgres.c:3002
long get_stack_depth_rlimit(void)
Definition: postgres.c:4961
bool set_plan_disabling_options(const char *arg, GucContext context, GucSource source)
Definition: postgres.c:3708
void PostgresMain(const char *dbname, const char *username) pg_attribute_noreturn()
Definition: postgres.c:4152
int check_log_duration(char *msec_str, bool was_logged)
Definition: postgres.c:2379
List * pg_analyze_and_rewrite_varparams(RawStmt *parsetree, const char *query_string, Oid **paramTypes, int *numParams, QueryEnvironment *queryEnv)
Definition: postgres.c:710
void HandleRecoveryConflictInterrupt(ProcSignalReason reason)
Definition: postgres.c:3035
LogStmtLevel
Definition: tcopprot.h:36
@ LOGSTMT_NONE
Definition: tcopprot.h:37
@ LOGSTMT_MOD
Definition: tcopprot.h:39
@ LOGSTMT_DDL
Definition: tcopprot.h:38
@ LOGSTMT_ALL
Definition: tcopprot.h:40
List * pg_analyze_and_rewrite_withcb(RawStmt *parsetree, const char *query_string, ParserSetupHook parserSetup, void *parserSetupArg, QueryEnvironment *queryEnv)
Definition: postgres.c:764
void ShowUsage(const char *title)
Definition: postgres.c:5000
void PostgresSingleUserMain(int argc, char *argv[], const char *username) pg_attribute_noreturn()
Definition: postgres.c:4042
List * pg_analyze_and_rewrite_fixedparams(RawStmt *parsetree, const char *query_string, const Oid *paramTypes, int numParams, QueryEnvironment *queryEnv)
Definition: postgres.c:671
PGDLLIMPORT int log_statement
Definition: postgres.c:95
PGDLLIMPORT int max_stack_depth
Definition: postgres.c:98
List * pg_rewrite_query(Query *query)
Definition: postgres.c:804
void die(SIGNAL_ARGS)
Definition: postgres.c:2972
const char * get_stats_option_name(const char *arg)
Definition: postgres.c:3750
void ProcessClientReadInterrupt(bool blocked)
Definition: postgres.c:509
PlannedStmt * pg_plan_query(Query *querytree, const char *query_string, int cursorOptions, ParamListInfo boundParams)
Definition: postgres.c:886
void ProcessClientWriteInterrupt(bool blocked)
Definition: postgres.c:555
void ResetUsage(void)
Definition: postgres.c:4993
List * pg_plan_queries(List *querytrees, const char *query_string, int cursorOptions, ParamListInfo boundParams)
Definition: postgres.c:972
void quickdie(SIGNAL_ARGS) pg_attribute_noreturn()
Definition: postgres.c:2875
PGDLLIMPORT CommandDest whereToSendOutput
Definition: postgres.c:90
PGDLLIMPORT int client_connection_check_interval
Definition: postgres.c:104