PostgreSQL Source Code git master
Loading...
Searching...
No Matches
execdesc.h
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * execdesc.h
4 * plan and query descriptor accessor macros used by the executor
5 * and related modules.
6 *
7 *
8 * Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
9 * Portions Copyright (c) 1994, Regents of the University of California
10 *
11 * src/include/executor/execdesc.h
12 *
13 *-------------------------------------------------------------------------
14 */
15#ifndef EXECDESC_H
16#define EXECDESC_H
17
18#include "nodes/execnodes.h"
19#include "tcop/dest.h"
20
21
22/* ----------------
23 * query descriptor:
24 *
25 * a QueryDesc encapsulates everything that the executor
26 * needs to execute the query.
27 *
28 * For the convenience of SQL-language functions, we also support QueryDescs
29 * containing utility statements; these must not be passed to the executor
30 * however.
31 * ---------------------
32 */
33typedef struct QueryDesc
34{
35 /* These fields are provided by CreateQueryDesc */
36 CmdType operation; /* CMD_SELECT, CMD_UPDATE, etc. */
37 PlannedStmt *plannedstmt; /* planner's output (could be utility, too) */
38 const char *sourceText; /* source text of the query */
39 Snapshot snapshot; /* snapshot to use for query */
40 Snapshot crosscheck_snapshot; /* crosscheck for RI update/delete */
41 DestReceiver *dest; /* the destination for tuple output */
42 ParamListInfo params; /* param values being passed in */
43 QueryEnvironment *queryEnv; /* query environment passed in */
44 int instrument_options; /* OR of InstrumentOption flags */
45 int query_instr_options; /* OR of InstrumentOption flags for
46 * query_instr */
47
48 /* These fields are set by ExecutorStart */
49 TupleDesc tupDesc; /* descriptor for result tuples */
50 EState *estate; /* executor's query-wide state */
51 PlanState *planstate; /* tree of per-plan-node state */
52
53 /* This field is set by ExecutePlan */
54 bool already_executed; /* true if previously executed */
55
56 /* This field is allocated by ExecutorStart if needed */
57 struct Instrumentation *query_instr; /* query level instrumentation */
59
60/* in pquery.c */
61extern QueryDesc *CreateQueryDesc(PlannedStmt *plannedstmt,
62 const char *sourceText,
63 Snapshot snapshot,
64 Snapshot crosscheck_snapshot,
65 DestReceiver *dest,
66 ParamListInfo params,
67 QueryEnvironment *queryEnv,
68 int instrument_options);
69
70extern void FreeQueryDesc(QueryDesc *qdesc);
71
72#endif /* EXECDESC_H */
void FreeQueryDesc(QueryDesc *qdesc)
Definition pquery.c:107
QueryDesc * CreateQueryDesc(PlannedStmt *plannedstmt, const char *sourceText, Snapshot snapshot, Snapshot crosscheck_snapshot, DestReceiver *dest, ParamListInfo params, QueryEnvironment *queryEnv, int instrument_options)
Definition pquery.c:68
CmdType
Definition nodes.h:273
static int fb(int x)
const char * sourceText
Definition execdesc.h:38
ParamListInfo params
Definition execdesc.h:42
DestReceiver * dest
Definition execdesc.h:41
int instrument_options
Definition execdesc.h:44
EState * estate
Definition execdesc.h:50
CmdType operation
Definition execdesc.h:36
Snapshot snapshot
Definition execdesc.h:39
bool already_executed
Definition execdesc.h:54
PlannedStmt * plannedstmt
Definition execdesc.h:37
int query_instr_options
Definition execdesc.h:45
QueryEnvironment * queryEnv
Definition execdesc.h:43
struct Instrumentation * query_instr
Definition execdesc.h:57
TupleDesc tupDesc
Definition execdesc.h:49
Snapshot crosscheck_snapshot
Definition execdesc.h:40
PlanState * planstate
Definition execdesc.h:51