]> granicus.if.org Git - postgresql/blob - src/include/executor/execdesc.h
pgindent run for 8.3.
[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-2007, PostgreSQL Global Development Group
9  * Portions Copyright (c) 1994, Regents of the University of California
10  *
11  * $PostgreSQL: pgsql/src/include/executor/execdesc.h,v 1.35 2007/11/15 21:14:43 momjian Exp $
12  *
13  *-------------------------------------------------------------------------
14  */
15 #ifndef EXECDESC_H
16 #define EXECDESC_H
17
18 #include "nodes/execnodes.h"
19 #include "nodes/plannodes.h"
20 #include "tcop/dest.h"
21
22
23 /* ----------------
24  *              query descriptor:
25  *
26  *      a QueryDesc encapsulates everything that the executor
27  *      needs to execute the query.
28  *
29  *      For the convenience of SQL-language functions, we also support QueryDescs
30  *      containing utility statements; these must not be passed to the executor
31  *      however.
32  * ---------------------
33  */
34 typedef struct QueryDesc
35 {
36         /* These fields are provided by CreateQueryDesc */
37         CmdType         operation;              /* CMD_SELECT, CMD_UPDATE, etc. */
38         PlannedStmt *plannedstmt;       /* planner's output, or null if utility */
39         Node       *utilitystmt;        /* utility statement, or null */
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         bool            doInstrument;   /* TRUE requests runtime instrumentation */
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 } QueryDesc;
51
52 /* in pquery.c */
53 extern QueryDesc *CreateQueryDesc(PlannedStmt * plannedstmt,
54                                 Snapshot snapshot,
55                                 Snapshot crosscheck_snapshot,
56                                 DestReceiver *dest,
57                                 ParamListInfo params,
58                                 bool doInstrument);
59
60 extern QueryDesc *CreateUtilityQueryDesc(Node *utilitystmt,
61                                            Snapshot snapshot,
62                                            DestReceiver *dest,
63                                            ParamListInfo params);
64
65 extern void FreeQueryDesc(QueryDesc *qdesc);
66
67 #endif   /* EXECDESC_H  */