executor.h 5.55 KB
Newer Older
1 2
/*-------------------------------------------------------------------------
 *
3
 * executor.h
4
 *	  support for the POSTGRES executor module
5 6 7 8
 *
 *
 * Copyright (c) 1994, Regents of the University of California
 *
9
 * $Id: executor.h,v 1.38 1999/09/24 00:25:10 tgl Exp $
10 11 12 13 14 15
 *
 *-------------------------------------------------------------------------
 */
#ifndef EXECUTOR_H
#define EXECUTOR_H

16
#include "executor/execdesc.h"
Marc G. Fournier's avatar
Marc G. Fournier committed
17

18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
/* ----------------
 *		TupIsNull
 *
 *		This is used mainly to detect when there are no more
 *		tuples to process.
 * ----------------
 */
/* return: true if tuple in slot is NULL, slot is slot to test */
#define TupIsNull(slot) \
( \
	((slot) == NULL) ? \
		true \
	: \
	( \
		((slot)->val == NULL) ? \
			true \
		: \
			false \
	) \
)

39 40 41
/*
 * prototypes from functions in execAmi.c
 */
42 43
extern void ExecOpenScanR(Oid relOid, int nkeys, ScanKey skeys, bool isindex,
			  ScanDirection dir, Snapshot snapshot,
44
			  Relation *returnRelation, Pointer *returnScanDesc);
45 46
extern void ExecCloseR(Plan *node);
extern void ExecReScan(Plan *node, ExprContext *exprCtxt, Plan *parent);
47
extern HeapScanDesc ExecReScanR(Relation relDesc, HeapScanDesc scanDesc,
48
			ScanDirection direction, int nkeys, ScanKey skeys);
49 50
extern void ExecMarkPos(Plan *node);
extern void ExecRestrPos(Plan *node);
51 52 53 54 55
extern Relation ExecCreatR(TupleDesc tupType, Oid relationOid);

/*
 * prototypes from functions in execJunk.c
 */
56
extern JunkFilter *ExecInitJunkFilter(List *targetList);
57
extern bool ExecGetJunkAttribute(JunkFilter *junkfilter, TupleTableSlot *slot,
58 59
					 char *attrName, Datum *value, bool *isNull);
extern HeapTuple ExecRemoveJunk(JunkFilter *junkfilter, TupleTableSlot *slot);
60 61 62 63 64


/*
 * prototypes from functions in execMain.c
 */
65
extern TupleDesc ExecutorStart(QueryDesc *queryDesc, EState *estate);
Bruce Momjian's avatar
Bruce Momjian committed
66 67
extern TupleTableSlot *ExecutorRun(QueryDesc *queryDesc, EState *estate,
			int feature, Node *limoffset, Node *limcount);
68
extern void ExecutorEnd(QueryDesc *queryDesc, EState *estate);
Bruce Momjian's avatar
Bruce Momjian committed
69 70 71
extern void ExecConstraints(char *caller, Relation rel, HeapTuple tuple,
				EState *estate);

72 73 74
/*
 * prototypes from functions in execProcnode.c
 */
75 76 77 78
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);
79 80 81 82

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

86
extern Datum ExecExtractResult(TupleTableSlot *slot, AttrNumber attnum,
87
				  bool *isNull);
88
extern Datum ExecEvalParam(Param *expression, ExprContext *econtext,
89
			  bool *isNull);
90 91

/* stop here */
92
extern char *GetAttributeByNum(TupleTableSlot *slot, AttrNumber attrno,
93
				  bool *isNull);
94
extern char *GetAttributeByName(TupleTableSlot *slot, char *attname, bool *isNull);
95
extern Datum ExecEvalExpr(Node *expression, ExprContext *econtext, bool *isNull,
96 97 98 99
			 bool *isDone);
extern bool ExecQual(List *qual, ExprContext *econtext);
extern int	ExecTargetListLength(List *targetlist);
extern TupleTableSlot *ExecProject(ProjectionInfo *projInfo, bool *isDone);
100 101 102 103

/*
 * prototypes from functions in execScan.c
 */
104
extern TupleTableSlot *ExecScan(Scan *node, TupleTableSlot *(*accessMtd) ());
105 106 107 108 109

/*
 * prototypes from functions in execTuples.c
 */
extern TupleTable ExecCreateTupleTable(int initialSize);
110
extern void ExecDestroyTupleTable(TupleTable table, bool shouldFree);
111
extern TupleTableSlot *ExecAllocTableSlot(TupleTable table);
112
extern TupleTableSlot *ExecStoreTuple(HeapTuple tuple,
113
			   TupleTableSlot *slot,
114 115
			   Buffer buffer,
			   bool shouldFree);
116
extern TupleTableSlot *ExecClearTuple(TupleTableSlot *slot);
117
extern TupleDesc ExecSetSlotDescriptor(TupleTableSlot *slot,
118
					  TupleDesc tupdesc);
119 120
extern void ExecSetSlotDescriptorIsNew(TupleTableSlot *slot, bool isNew);
extern void ExecInitResultTupleSlot(EState *estate, CommonState *commonstate);
121
extern void ExecInitScanTupleSlot(EState *estate,
122 123
					  CommonScanState *commonscanstate);
extern void ExecInitOuterTupleSlot(EState *estate, HashJoinState *hashstate);
124

125 126
extern TupleDesc ExecGetTupType(Plan *node);
extern TupleDesc ExecTypeFromTL(List *targetList);
127
extern void SetChangedParamList(Plan *node, List *newchg);
128 129

/*
130
 * prototypes from functions in execUtils.c
131
 */
132
extern void ResetTupleCount(void);
133
extern void ExecAssignNodeBaseInfo(EState *estate, CommonState *basenode,
134 135
					   Plan *parent);
extern void ExecAssignExprContext(EState *estate, CommonState *commonstate);
136
extern void ExecAssignResultType(CommonState *commonstate,
137
					 TupleDesc tupDesc);
138
extern void ExecAssignResultTypeFromOuterPlan(Plan *node,
139 140 141 142 143
								  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);
144 145
extern void ExecFreeExprContext(CommonState *commonstate);
extern void ExecFreeTypeInfo(CommonState *commonstate);
146
extern TupleDesc ExecGetScanType(CommonScanState *csstate);
147
extern void ExecAssignScanType(CommonScanState *csstate,
148
				   TupleDesc tupDesc);
149
extern void ExecAssignScanTypeFromOuterPlan(Plan *node,
150
								CommonScanState *csstate);
151
extern Form_pg_attribute ExecGetTypeInfo(Relation relDesc);
152

153
extern void ExecOpenIndices(Oid resultRelationOid,
154 155
				RelationInfo *resultRelationInfo);
extern void ExecCloseIndices(RelationInfo *resultRelationInfo);
156
extern void ExecInsertIndexTuples(TupleTableSlot *slot, ItemPointer tupleid,
157
					  EState *estate, bool is_update);
158

159
#endif	 /* EXECUTOR_H	*/