1996-07-09 08:22:35 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01:00
|
|
|
* execdesc.h
|
1997-09-07 07:04:48 +02:00
|
|
|
* plan and query descriptor accessor macros used by the executor
|
|
|
|
* and related modules.
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
|
|
|
*
|
2009-01-01 18:24:05 +01:00
|
|
|
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
|
2000-01-26 06:58:53 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
2009-01-02 21:42:00 +01:00
|
|
|
* $PostgreSQL: pgsql/src/include/executor/execdesc.h,v 1.40 2009/01/02 20:42:00 tgl Exp $
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef EXECDESC_H
|
|
|
|
#define EXECDESC_H
|
|
|
|
|
2002-12-05 16:50:39 +01:00
|
|
|
#include "nodes/execnodes.h"
|
2007-02-20 18:32:18 +01:00
|
|
|
#include "nodes/plannodes.h"
|
1999-07-16 19:07:40 +02:00
|
|
|
#include "tcop/dest.h"
|
1996-07-09 08:22:35 +02:00
|
|
|
|
2002-02-27 20:36:13 +01:00
|
|
|
|
1996-07-09 08:22:35 +02:00
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* query descriptor:
|
2002-12-05 16:50:39 +01:00
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* a QueryDesc encapsulates everything that the executor
|
2007-02-20 18:32:18 +01:00
|
|
|
* needs to execute the query.
|
|
|
|
*
|
|
|
|
* For the convenience of SQL-language functions, we also support QueryDescs
|
|
|
|
* containing utility statements; these must not be passed to the executor
|
|
|
|
* however.
|
1996-07-09 08:22:35 +02:00
|
|
|
* ---------------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct QueryDesc
|
|
|
|
{
|
2002-12-05 16:50:39 +01:00
|
|
|
/* These fields are provided by CreateQueryDesc */
|
1997-09-08 04:41:22 +02:00
|
|
|
CmdType operation; /* CMD_SELECT, CMD_UPDATE, etc. */
|
2007-11-15 22:14:46 +01:00
|
|
|
PlannedStmt *plannedstmt; /* planner's output, or null if utility */
|
2007-02-20 18:32:18 +01:00
|
|
|
Node *utilitystmt; /* utility statement, or null */
|
2009-01-02 21:42:00 +01:00
|
|
|
const char *sourceText; /* source text of the query */
|
2004-09-13 22:10:13 +02:00
|
|
|
Snapshot snapshot; /* snapshot to use for query */
|
|
|
|
Snapshot crosscheck_snapshot; /* crosscheck for RI update/delete */
|
2003-05-06 22:26:28 +02:00
|
|
|
DestReceiver *dest; /* the destination for tuple output */
|
2002-12-05 16:50:39 +01:00
|
|
|
ParamListInfo params; /* param values being passed in */
|
|
|
|
bool doInstrument; /* TRUE requests runtime instrumentation */
|
2002-02-27 20:36:13 +01:00
|
|
|
|
2002-12-05 16:50:39 +01:00
|
|
|
/* These fields are set by ExecutorStart */
|
|
|
|
TupleDesc tupDesc; /* descriptor for result tuples */
|
|
|
|
EState *estate; /* executor's query-wide state */
|
|
|
|
PlanState *planstate; /* tree of per-plan-node state */
|
2008-11-19 02:10:24 +01:00
|
|
|
|
|
|
|
/* This is always set NULL by the core system, but plugins can change it */
|
|
|
|
struct Instrumentation *totaltime; /* total time spent in ExecutorRun */
|
1997-09-08 23:56:23 +02:00
|
|
|
} QueryDesc;
|
1996-07-09 08:22:35 +02:00
|
|
|
|
|
|
|
/* in pquery.c */
|
2007-11-15 23:25:18 +01:00
|
|
|
extern QueryDesc *CreateQueryDesc(PlannedStmt *plannedstmt,
|
2009-01-02 21:42:00 +01:00
|
|
|
const char *sourceText,
|
2004-09-13 22:10:13 +02:00
|
|
|
Snapshot snapshot,
|
|
|
|
Snapshot crosscheck_snapshot,
|
2003-08-04 02:43:34 +02:00
|
|
|
DestReceiver *dest,
|
|
|
|
ParamListInfo params,
|
|
|
|
bool doInstrument);
|
2001-10-28 07:26:15 +01:00
|
|
|
|
2007-02-20 18:32:18 +01:00
|
|
|
extern QueryDesc *CreateUtilityQueryDesc(Node *utilitystmt,
|
2009-01-02 21:42:00 +01:00
|
|
|
const char *sourceText,
|
2007-11-15 22:14:46 +01:00
|
|
|
Snapshot snapshot,
|
|
|
|
DestReceiver *dest,
|
|
|
|
ParamListInfo params);
|
2007-02-20 18:32:18 +01:00
|
|
|
|
2002-12-15 17:17:59 +01:00
|
|
|
extern void FreeQueryDesc(QueryDesc *qdesc);
|
|
|
|
|
2001-11-05 18:46:40 +01:00
|
|
|
#endif /* EXECDESC_H */
|