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-2019, 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/parsenodes.h"
19 #include "nodes/plannodes.h"
20 #include "storage/procsignal.h"
21 #include "utils/guc.h"
22 #include "utils/queryenvironment.h"
23 
24 
25 /* Required daylight between max_stack_depth and the kernel limit, in bytes */
26 #define STACK_DEPTH_SLOP (512 * 1024L)
27 
29 extern PGDLLIMPORT const char *debug_query_string;
30 extern int max_stack_depth;
31 extern 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_analyze_and_rewrite(RawStmt *parsetree,
47  const char *query_string,
48  Oid *paramTypes, int numParams,
49  QueryEnvironment *queryEnv);
50 extern List *pg_analyze_and_rewrite_params(RawStmt *parsetree,
51  const char *query_string,
52  ParserSetupHook parserSetup,
53  void *parserSetupArg,
54  QueryEnvironment *queryEnv);
55 extern PlannedStmt *pg_plan_query(Query *querytree, int cursorOptions,
56  ParamListInfo boundParams);
57 extern List *pg_plan_queries(List *querytrees, int cursorOptions,
58  ParamListInfo boundParams);
59 
60 extern bool check_max_stack_depth(int *newval, void **extra, GucSource source);
61 extern void assign_max_stack_depth(int newval, void *extra);
62 
63 extern void die(SIGNAL_ARGS);
67 extern void RecoveryConflictInterrupt(ProcSignalReason reason); /* called from SIGUSR1
68  * handler */
69 extern void ProcessClientReadInterrupt(bool blocked);
70 extern void ProcessClientWriteInterrupt(bool blocked);
71 
72 extern void process_postgres_switches(int argc, char *argv[],
73  GucContext ctx, const char **dbname);
74 extern void PostgresMain(int argc, char *argv[],
75  const char *dbname,
76  const char *username) pg_attribute_noreturn();
77 extern long get_stack_depth_rlimit(void);
78 extern void ResetUsage(void);
79 extern void ShowUsage(const char *title);
80 extern int check_log_duration(char *msec_str, bool was_logged);
81 extern void set_debug_options(int debug_flag,
82  GucContext context, GucSource source);
83 extern bool set_plan_disabling_options(const char *arg,
84  GucContext context, GucSource source);
85 extern const char *get_stats_option_name(const char *arg);
86 
87 #endif /* TCOPPROT_H */
int PostAuthDelay
Definition: postgres.c:100
GucContext
Definition: guc.h:68
bool check_max_stack_depth(int *newval, void **extra, GucSource source)
Definition: postgres.c:3347
CommandDest whereToSendOutput
Definition: postgres.c:89
CommandDest
Definition: dest.h:86
PGDLLIMPORT int log_statement
Definition: postgres.c:94
LogStmtLevel
Definition: tcopprot.h:35
void RecoveryConflictInterrupt(ProcSignalReason reason)
Definition: postgres.c:2871
unsigned int Oid
Definition: postgres_ext.h:31
int max_stack_depth
Definition: postgres.c:97
void PostgresMain(int argc, char *argv[], const char *dbname, const char *username) pg_attribute_noreturn()
Definition: postgres.c:3749
#define PGDLLIMPORT
Definition: c.h:1266
List * pg_analyze_and_rewrite(RawStmt *parsetree, const char *query_string, Oid *paramTypes, int numParams, QueryEnvironment *queryEnv)
Definition: postgres.c:674
GucSource
Definition: guc.h:105
List * pg_plan_queries(List *querytrees, int cursorOptions, ParamListInfo boundParams)
Definition: postgres.c:940
bool set_plan_disabling_options(const char *arg, GucContext context, GucSource source)
Definition: postgres.c:3408
int check_log_duration(char *msec_str, bool was_logged)
Definition: postgres.c:2235
void quickdie(SIGNAL_ARGS) pg_attribute_noreturn()
Definition: postgres.c:2716
void(* ParserSetupHook)(struct ParseState *pstate, void *arg)
Definition: params.h:108
PGDLLIMPORT const char * debug_query_string
Definition: postgres.c:86
List * pg_parse_query(const char *query_string)
Definition: postgres.c:626
void process_postgres_switches(int argc, char *argv[], GucContext ctx, const char **dbname)
Definition: postgres.c:3490
void set_debug_options(int debug_flag, GucContext context, GucSource source)
Definition: postgres.c:3379
const char * get_stats_option_name(const char *arg)
Definition: postgres.c:3450
List * pg_analyze_and_rewrite_params(RawStmt *parsetree, const char *query_string, ParserSetupHook parserSetup, void *parserSetupArg, QueryEnvironment *queryEnv)
Definition: postgres.c:711
long get_stack_depth_rlimit(void)
Definition: postgres.c:4537
static char * username
Definition: initdb.c:133
#define SIGNAL_ARGS
Definition: c.h:1282
void ProcessClientReadInterrupt(bool blocked)
Definition: postgres.c:524
char * dbname
Definition: streamutil.c:50
#define newval
PlannedStmt * pg_plan_query(Query *querytree, int cursorOptions, ParamListInfo boundParams)
Definition: postgres.c:855
void StatementCancelHandler(SIGNAL_ARGS)
Definition: postgres.c:2814
Datum querytree(PG_FUNCTION_ARGS)
Definition: _int_bool.c:664
#define pg_attribute_noreturn()
Definition: c.h:147
ProcSignalReason
Definition: procsignal.h:30
void * arg
void ShowUsage(const char *title)
Definition: postgres.c:4580
void die(SIGNAL_ARGS)
Definition: postgres.c:2783
void assign_max_stack_depth(int newval, void *extra)
Definition: postgres.c:3364
void FloatExceptionHandler(SIGNAL_ARGS) pg_attribute_noreturn()
Definition: postgres.c:2835
Definition: pg_list.h:50
void ResetUsage(void)
Definition: postgres.c:4573
void ProcessClientWriteInterrupt(bool blocked)
Definition: postgres.c:570