Header And Logo

PostgreSQL
| The world's most advanced open source database.

execdesc.h

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  * execdesc.h
00004  *    plan and query descriptor accessor macros used by the executor
00005  *    and related modules.
00006  *
00007  *
00008  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
00009  * Portions Copyright (c) 1994, Regents of the University of California
00010  *
00011  * src/include/executor/execdesc.h
00012  *
00013  *-------------------------------------------------------------------------
00014  */
00015 #ifndef EXECDESC_H
00016 #define EXECDESC_H
00017 
00018 #include "nodes/execnodes.h"
00019 #include "tcop/dest.h"
00020 
00021 
00022 /* ----------------
00023  *      query descriptor:
00024  *
00025  *  a QueryDesc encapsulates everything that the executor
00026  *  needs to execute the query.
00027  *
00028  *  For the convenience of SQL-language functions, we also support QueryDescs
00029  *  containing utility statements; these must not be passed to the executor
00030  *  however.
00031  * ---------------------
00032  */
00033 typedef struct QueryDesc
00034 {
00035     /* These fields are provided by CreateQueryDesc */
00036     CmdType     operation;      /* CMD_SELECT, CMD_UPDATE, etc. */
00037     PlannedStmt *plannedstmt;   /* planner's output, or null if utility */
00038     Node       *utilitystmt;    /* utility statement, or null */
00039     const char *sourceText;     /* source text of the query */
00040     Snapshot    snapshot;       /* snapshot to use for query */
00041     Snapshot    crosscheck_snapshot;    /* crosscheck for RI update/delete */
00042     DestReceiver *dest;         /* the destination for tuple output */
00043     ParamListInfo params;       /* param values being passed in */
00044     int         instrument_options;     /* OR of InstrumentOption flags */
00045 
00046     /* These fields are set by ExecutorStart */
00047     TupleDesc   tupDesc;        /* descriptor for result tuples */
00048     EState     *estate;         /* executor's query-wide state */
00049     PlanState  *planstate;      /* tree of per-plan-node state */
00050 
00051     /* This is always set NULL by the core system, but plugins can change it */
00052     struct Instrumentation *totaltime;  /* total time spent in ExecutorRun */
00053 } QueryDesc;
00054 
00055 /* in pquery.c */
00056 extern QueryDesc *CreateQueryDesc(PlannedStmt *plannedstmt,
00057                 const char *sourceText,
00058                 Snapshot snapshot,
00059                 Snapshot crosscheck_snapshot,
00060                 DestReceiver *dest,
00061                 ParamListInfo params,
00062                 int instrument_options);
00063 
00064 extern QueryDesc *CreateUtilityQueryDesc(Node *utilitystmt,
00065                        const char *sourceText,
00066                        Snapshot snapshot,
00067                        DestReceiver *dest,
00068                        ParamListInfo params);
00069 
00070 extern void FreeQueryDesc(QueryDesc *qdesc);
00071 
00072 #endif   /* EXECDESC_H  */