summaryrefslogtreecommitdiff
path: root/src/include/executor/executor.h
blob: c96f7439b6c82a7cf2801b56b99cce42572a5539 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/*-------------------------------------------------------------------------
 *
 * executor.h--
 *	  support for the POSTGRES executor module
 *
 *
 * Copyright (c) 1994, Regents of the University of California
 *
 * $Id: executor.h,v 1.11 1997/09/07 04:57:47 momjian Exp $
 *
 *-------------------------------------------------------------------------
 */
#ifndef EXECUTOR_H
#define EXECUTOR_H

#include <catalog/pg_index.h>
#include <access/itup.h>
#include <stdio.h>
#include <executor/execdesc.h>

/* ----------------------------------------------------------------
 * ----------------------------------------------------------------
 */


/*
 * prototypes from functions in execAmi.c
 */
extern void
ExecOpenScanR(Oid relOid, int nkeys, ScanKey skeys, bool isindex,
			  ScanDirection dir, TimeQual timeRange,
			  Relation * returnRelation, Pointer * returnScanDesc);
extern void		ExecCloseR(Plan * node);
extern void		ExecReScan(Plan * node, ExprContext * exprCtxt, Plan * parent);
extern HeapScanDesc
ExecReScanR(Relation relDesc, HeapScanDesc scanDesc,
			ScanDirection direction, int nkeys, ScanKey skeys);
extern void		ExecMarkPos(Plan * node);
extern void		ExecRestrPos(Plan * node);
extern Relation ExecCreatR(TupleDesc tupType, Oid relationOid);

/*
 * prototypes from functions in execJunk.c
 */
extern JunkFilter *ExecInitJunkFilter(List * targetList);
extern bool
ExecGetJunkAttribute(JunkFilter * junkfilter, TupleTableSlot * slot,
					 char *attrName, Datum * value, bool * isNull);
extern HeapTuple ExecRemoveJunk(JunkFilter * junkfilter, TupleTableSlot * slot);


/*
 * prototypes from functions in execMain.c
 */
extern TupleDesc ExecutorStart(QueryDesc * queryDesc, EState * estate);
extern TupleTableSlot *ExecutorRun(QueryDesc * queryDesc, EState * estate, int feature, int count);
extern void		ExecutorEnd(QueryDesc * queryDesc, EState * estate);
extern HeapTuple ExecConstraints(char *caller, Relation rel, HeapTuple tuple);

/*
 * prototypes from functions in execProcnode.c
 */
extern bool		ExecInitNode(Plan * node, EState * estate, Plan * parent);
extern TupleTableSlot *ExecProcNode(Plan * node, Plan * parent);
extern int		ExecCountSlotsNode(Plan * node);
extern void		ExecEndNode(Plan * node, Plan * parent);

/*
 * prototypes from functions in execQual.c
 */
extern bool		execConstByVal;
extern int		execConstLen;

extern Datum
ExecExtractResult(TupleTableSlot * slot, AttrNumber attnum,
				  bool * isNull);
extern Datum
ExecEvalParam(Param * expression, ExprContext * econtext,
			  bool * isNull);

/* stop here */
extern char    *
GetAttributeByName(TupleTableSlot * slot, char *attname,
				   bool * isNull);
extern Datum
ExecEvalExpr(Node * expression, ExprContext * econtext, bool * isNull,
			 bool * isDone);
extern bool		ExecQual(List * qual, ExprContext * econtext);
extern int		ExecTargetListLength(List * targetlist);
extern TupleTableSlot *ExecProject(ProjectionInfo * projInfo, bool * isDone);

/*
 * prototypes from functions in execScan.c
 */
extern TupleTableSlot *ExecScan(Scan * node, TupleTableSlot * (*accessMtd) ());

/*
 * prototypes from functions in execTuples.c
 */
extern TupleTable ExecCreateTupleTable(int initialSize);
extern void		ExecDestroyTupleTable(TupleTable table, bool shouldFree);
extern TupleTableSlot *ExecAllocTableSlot(TupleTable table);
extern TupleTableSlot *
ExecStoreTuple(HeapTuple tuple,
			   TupleTableSlot * slot,
			   Buffer buffer,
			   bool shouldFree);
extern TupleTableSlot *ExecClearTuple(TupleTableSlot * slot);
extern bool		ExecSetSlotPolicy(TupleTableSlot * slot, bool shouldFree);
extern TupleDesc
ExecSetSlotDescriptor(TupleTableSlot * slot,
					  TupleDesc tupdesc);
extern void		ExecSetSlotDescriptorIsNew(TupleTableSlot * slot, bool isNew);
extern void		ExecIncrSlotBufferRefcnt(TupleTableSlot * slot);
extern bool		TupIsNull(TupleTableSlot * slot);
extern void		ExecInitResultTupleSlot(EState * estate, CommonState * commonstate);
extern void
ExecInitScanTupleSlot(EState * estate,
					  CommonScanState * commonscanstate);
extern void		ExecInitMarkedTupleSlot(EState * estate, MergeJoinState * mergestate);
extern void		ExecInitOuterTupleSlot(EState * estate, HashJoinState * hashstate);

extern TupleDesc ExecGetTupType(Plan * node);
extern TupleDesc ExecTypeFromTL(List * targetList);

/*
 * prototypes from functions in execTuples.c
 */
extern void		ResetTupleCount(void);
extern void
ExecAssignNodeBaseInfo(EState * estate, CommonState * basenode,
					   Plan * parent);
extern void		ExecAssignExprContext(EState * estate, CommonState * commonstate);
extern void
ExecAssignResultType(CommonState * commonstate,
					 TupleDesc tupDesc);
extern void
ExecAssignResultTypeFromOuterPlan(Plan * node,
								  CommonState * commonstate);
extern void		ExecAssignResultTypeFromTL(Plan * node, CommonState * commonstate);
extern TupleDesc ExecGetResultType(CommonState * commonstate);
extern void		ExecAssignProjectionInfo(Plan * node, CommonState * commonstate);
extern void		ExecFreeProjectionInfo(CommonState * commonstate);
extern TupleDesc ExecGetScanType(CommonScanState * csstate);
extern void
ExecAssignScanType(CommonScanState * csstate,
				   TupleDesc tupDesc);
extern void
ExecAssignScanTypeFromOuterPlan(Plan * node,
								CommonScanState * csstate);
extern AttributeTupleForm ExecGetTypeInfo(Relation relDesc);

extern void
ExecOpenIndices(Oid resultRelationOid,
				RelationInfo * resultRelationInfo);
extern void		ExecCloseIndices(RelationInfo * resultRelationInfo);
extern void
ExecInsertIndexTuples(TupleTableSlot * slot, ItemPointer tupleid,
					  EState * estate, bool is_update);
extern void		resetVarAttrLenForCreateTable(TupleDesc tupType);
extern void
setVarAttrLenForCreateTable(TupleDesc tupType,
							List * targetList, List * rangeTable);


/* ----------------------------------------------------------------
 *		the end
 * ----------------------------------------------------------------
 */

#endif							/* EXECUTOR_H  */