]> granicus.if.org Git - postgresql/blob - src/include/executor/execdesc.h
Update copyright for 2014
[postgresql] / src / include / executor / execdesc.h
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-2014, 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  */
33 typedef struct QueryDesc
34 {
35         /* These fields are provided by CreateQueryDesc */
36         CmdType         operation;              /* CMD_SELECT, CMD_UPDATE, etc. */
37         PlannedStmt *plannedstmt;       /* planner's output, or null if utility */
38         Node       *utilitystmt;        /* utility statement, or null */
39         const char *sourceText;         /* source text of the query */
40         Snapshot        snapshot;               /* snapshot to use for query */
41         Snapshot        crosscheck_snapshot;    /* crosscheck for RI update/delete */
42         DestReceiver *dest;                     /* the destination for tuple output */
43         ParamListInfo params;           /* param values being passed in */
44         int                     instrument_options;             /* OR of InstrumentOption flags */
45
46         /* These fields are set by ExecutorStart */
47         TupleDesc       tupDesc;                /* descriptor for result tuples */
48         EState     *estate;                     /* executor's query-wide state */
49         PlanState  *planstate;          /* tree of per-plan-node state */
50
51         /* This is always set NULL by the core system, but plugins can change it */
52         struct Instrumentation *totaltime;      /* total time spent in ExecutorRun */
53 } QueryDesc;
54
55 /* in pquery.c */
56 extern QueryDesc *CreateQueryDesc(PlannedStmt *plannedstmt,
57                                 const char *sourceText,
58                                 Snapshot snapshot,
59                                 Snapshot crosscheck_snapshot,
60                                 DestReceiver *dest,
61                                 ParamListInfo params,
62                                 int instrument_options);
63
64 extern QueryDesc *CreateUtilityQueryDesc(Node *utilitystmt,
65                                            const char *sourceText,
66                                            Snapshot snapshot,
67                                            DestReceiver *dest,
68                                            ParamListInfo params);
69
70 extern void FreeQueryDesc(QueryDesc *qdesc);
71
72 #endif   /* EXECDESC_H  */