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
28extern CommandDest whereToSendOutput;
29extern PGDLLIMPORT const char *debug_query_string;
30extern int max_stack_depth;
31extern int PostAuthDelay;
32
33/* GUC-configurable parameters */
34
35typedef 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
43extern PGDLLIMPORT int log_statement;
44
45extern List *pg_parse_query(const char *query_string);
46extern List *pg_analyze_and_rewrite(RawStmt *parsetree,
47 const char *query_string,
48 Oid *paramTypes, int numParams,
49 QueryEnvironment *queryEnv);
50extern List *pg_analyze_and_rewrite_params(RawStmt *parsetree,
51 const char *query_string,
52 ParserSetupHook parserSetup,
53 void *parserSetupArg,
54 QueryEnvironment *queryEnv);
55extern PlannedStmt *pg_plan_query(Query *querytree, int cursorOptions,
56 ParamListInfo boundParams);
57extern List *pg_plan_queries(List *querytrees, int cursorOptions,
58 ParamListInfo boundParams);
59
60extern bool check_max_stack_depth(int *newval, void **extra, GucSource source);
61extern void assign_max_stack_depth(int newval, void *extra);
62
63extern void die(SIGNAL_ARGS);
64extern void quickdie(SIGNAL_ARGS) pg_attribute_noreturn();
65extern void StatementCancelHandler(SIGNAL_ARGS);
66extern void FloatExceptionHandler(SIGNAL_ARGS) pg_attribute_noreturn();
67extern void RecoveryConflictInterrupt(ProcSignalReason reason); /* called from SIGUSR1
68 * handler */
69extern void ProcessClientReadInterrupt(bool blocked);
70extern void ProcessClientWriteInterrupt(bool blocked);
71
72extern void process_postgres_switches(int argc, char *argv[],
73 GucContext ctx, const char **dbname);
74extern void PostgresMain(int argc, char *argv[],
75 const char *dbname,
76 const char *username) pg_attribute_noreturn();
77extern long get_stack_depth_rlimit(void);
78extern void ResetUsage(void);
79extern void ShowUsage(const char *title);
80extern int check_log_duration(char *msec_str, bool was_logged);
81extern void set_debug_options(int debug_flag,
82 GucContext context, GucSource source);
83extern bool set_plan_disabling_options(const char *arg,
84 GucContext context, GucSource source);
85extern const char *get_stats_option_name(const char *arg);
86
87#endif /* TCOPPROT_H */
88