mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-09 03:29:22 +02:00
* Buffer refcount cleanup (per my "progress report" to pghackers, 9/22). * Add links to backend PROC structs to sinval's array of per-backend info, and use these links for routines that need to check the state of all backends (rather than the slow, complicated search of the ShmemIndex hashtable that was used before). Add databaseOID to PROC structs. * Use this to implement an interlock that prevents DESTROY DATABASE of a database containing running backends. (It's a little tricky to prevent a concurrently-starting backend from getting in there, since the new backend is not able to lock anything at the time it tries to look up its database in pg_database. My solution is to recheck that the DB is OK at the end of InitPostgres. It may not be a 100% solution, but it's a lot better than no interlock at all...) * In ALTER TABLE RENAME, flush buffers for the relation before doing the rename of the physical files, to ensure we don't get failures later from mdblindwrt(). * Update TRUNCATE patch so that it actually compiles against current sources :-(. You should do "make clean all" after pulling these changes.
160 lines
5.5 KiB
C
160 lines
5.5 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* executor.h
|
|
* support for the POSTGRES executor module
|
|
*
|
|
*
|
|
* Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
* $Id: executor.h,v 1.38 1999/09/24 00:25:10 tgl Exp $
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#ifndef EXECUTOR_H
|
|
#define EXECUTOR_H
|
|
|
|
#include "executor/execdesc.h"
|
|
|
|
/* ----------------
|
|
* 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 \
|
|
) \
|
|
)
|
|
|
|
/*
|
|
* prototypes from functions in execAmi.c
|
|
*/
|
|
extern void ExecOpenScanR(Oid relOid, int nkeys, ScanKey skeys, bool isindex,
|
|
ScanDirection dir, Snapshot snapshot,
|
|
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, Node *limoffset, Node *limcount);
|
|
extern void ExecutorEnd(QueryDesc *queryDesc, EState *estate);
|
|
extern void ExecConstraints(char *caller, Relation rel, HeapTuple tuple,
|
|
EState *estate);
|
|
|
|
/*
|
|
* 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 *GetAttributeByNum(TupleTableSlot *slot, AttrNumber attrno,
|
|
bool *isNull);
|
|
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 TupleDesc ExecSetSlotDescriptor(TupleTableSlot *slot,
|
|
TupleDesc tupdesc);
|
|
extern void ExecSetSlotDescriptorIsNew(TupleTableSlot *slot, bool isNew);
|
|
extern void ExecInitResultTupleSlot(EState *estate, CommonState *commonstate);
|
|
extern void ExecInitScanTupleSlot(EState *estate,
|
|
CommonScanState *commonscanstate);
|
|
extern void ExecInitOuterTupleSlot(EState *estate, HashJoinState *hashstate);
|
|
|
|
extern TupleDesc ExecGetTupType(Plan *node);
|
|
extern TupleDesc ExecTypeFromTL(List *targetList);
|
|
extern void SetChangedParamList(Plan *node, List *newchg);
|
|
|
|
/*
|
|
* prototypes from functions in execUtils.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 void ExecFreeExprContext(CommonState *commonstate);
|
|
extern void ExecFreeTypeInfo(CommonState *commonstate);
|
|
extern TupleDesc ExecGetScanType(CommonScanState *csstate);
|
|
extern void ExecAssignScanType(CommonScanState *csstate,
|
|
TupleDesc tupDesc);
|
|
extern void ExecAssignScanTypeFromOuterPlan(Plan *node,
|
|
CommonScanState *csstate);
|
|
extern Form_pg_attribute 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);
|
|
|
|
#endif /* EXECUTOR_H */
|