diff options
| author | Marc G. Fournier | 1996-08-28 07:27:54 +0000 |
|---|---|---|
| committer | Marc G. Fournier | 1996-08-28 07:27:54 +0000 |
| commit | 870be9fa8e5ead7a9fec1b1cf539c701bba57d2a (patch) | |
| tree | 0980ed1b45ec7974d2ceea9df3d0570c165804b6 /src/backend/nodes | |
| parent | 907c884fe8b88d3df5883c278cacb094a1cfc7ac (diff) | |
Clean up th ecompile process by centralizing the include files
- code compile tested, but due to a yet unresolved problem with
parse.h's creation, compile not completed...
Diffstat (limited to 'src/backend/nodes')
| -rw-r--r-- | src/backend/nodes/execnodes.h | 689 | ||||
| -rw-r--r-- | src/backend/nodes/makefuncs.h | 48 | ||||
| -rw-r--r-- | src/backend/nodes/memnodes.h | 101 | ||||
| -rw-r--r-- | src/backend/nodes/nodeFuncs.h | 23 | ||||
| -rw-r--r-- | src/backend/nodes/nodes.h | 299 | ||||
| -rw-r--r-- | src/backend/nodes/params.h | 90 | ||||
| -rw-r--r-- | src/backend/nodes/parsenodes.h | 736 | ||||
| -rw-r--r-- | src/backend/nodes/pg_list.h | 112 | ||||
| -rw-r--r-- | src/backend/nodes/plannodes.h | 330 | ||||
| -rw-r--r-- | src/backend/nodes/primnodes.h | 318 | ||||
| -rw-r--r-- | src/backend/nodes/readfuncs.h | 27 | ||||
| -rw-r--r-- | src/backend/nodes/relation.h | 279 |
12 files changed, 0 insertions, 3052 deletions
diff --git a/src/backend/nodes/execnodes.h b/src/backend/nodes/execnodes.h deleted file mode 100644 index 6fb093a2e2a..00000000000 --- a/src/backend/nodes/execnodes.h +++ /dev/null @@ -1,689 +0,0 @@ -/*------------------------------------------------------------------------- - * - * execnodes.h-- - * definitions for executor state nodes - * - * - * Copyright (c) 1994, Regents of the University of California - * - * $Id: execnodes.h,v 1.1.1.1 1996/07/09 06:21:32 scrappy Exp $ - * - *------------------------------------------------------------------------- - */ -#ifndef EXECNODES_H -#define EXECNODES_H - -#include "postgres.h" - -#include "nodes/nodes.h" -#include "nodes/primnodes.h" -#include "nodes/pg_list.h" - -#include "nodes/memnodes.h" - -#include "storage/item.h" -#include "access/sdir.h" -#include "access/htup.h" -#include "access/tupdesc.h" -#include "access/funcindex.h" -#include "utils/rel.h" -#include "access/relscan.h" -#include "executor/hashjoin.h" -#include "executor/tuptable.h" - -/* ---------------- - * IndexInfo information - * - * this class holds the information saying what attributes - * are the key attributes for this index. -cim 10/15/89 - * - * NumKeyAttributes number of key attributes for this index - * KeyAttributeNumbers array of attribute numbers used as keys - * Predicate partial-index predicate for this index - * ---------------- - */ -typedef struct IndexInfo { - NodeTag type; - int ii_NumKeyAttributes; - AttrNumber *ii_KeyAttributeNumbers; - FuncIndexInfoPtr ii_FuncIndexInfo; - Node *ii_Predicate; -} IndexInfo; - -/* ---------------- - * RelationInfo information - * - * whenever we update an existing relation, we have to - * update indices on the relation. The RelationInfo class - * is used to hold all the information on result relations, - * including indices.. -cim 10/15/89 - * - * RangeTableIndex result relation's range table index - * RelationDesc relation descriptor for result relation - * NumIndices number indices existing on result relation - * IndexRelationDescs array of relation descriptors for indices - * IndexRelationInfo array of key/attr info for indices - * ---------------- - */ -typedef struct RelationInfo { - NodeTag type; - Index ri_RangeTableIndex; - Relation ri_RelationDesc; - int ri_NumIndices; - RelationPtr ri_IndexRelationDescs; - IndexInfo **ri_IndexRelationInfo; -} RelationInfo; - -/* ---------------- - * ExprContext - * - * This class holds the "current context" information - * needed to evaluate expressions for doing tuple qualifications - * and tuple projections. For example, if an expression refers - * to an attribute in the current inner tuple then we need to know - * what the current inner tuple is and so we look at the expression - * context. - * ---------------- - */ -typedef struct ExprContext { - NodeTag type; - TupleTableSlot *ecxt_scantuple; - TupleTableSlot *ecxt_innertuple; - TupleTableSlot *ecxt_outertuple; - Relation ecxt_relation; - Index ecxt_relid; - ParamListInfo ecxt_param_list_info; - List *ecxt_range_table; - Datum *ecxt_values; /* precomputed values for aggreg */ - char *ecxt_nulls; /* null flags for aggreg values */ -} ExprContext; - -/* ---------------- - * ProjectionInfo node information - * - * This is all the information needed to preform projections - * on a tuple. Nodes which need to do projections create one - * of these. In theory, when a node wants to preform a projection - * it should just update this information as necessary and then - * call ExecProject(). -cim 6/3/91 - * - * targetlist target list for projection - * len length of target list - * tupValue array of pointers to projection results - * exprContext expression context for ExecTargetList - * slot slot to place projection result in - * ---------------- - */ -typedef struct ProjectionInfo { - NodeTag type; - List *pi_targetlist; - int pi_len; - Datum *pi_tupValue; - ExprContext *pi_exprContext; - TupleTableSlot *pi_slot; -} ProjectionInfo; - -/* ---------------- - * JunkFilter - * - * this class is used to store information regarding junk attributes. - * A junk attribute is an attribute in a tuple that is needed only for - * storing intermediate information in the executor, and does not belong - * in the tuple proper. For example, when we do a delete or replace - * query, the planner adds an entry to the targetlist so that the tuples - * returned to ExecutePlan() contain an extra attribute: the t_ctid of - * the tuple to be deleted/replaced. This is needed for amdelete() and - * amreplace(). In doing a delete this does not make much of a - * difference, but in doing a replace we have to make sure we disgard - * all the junk in a tuple before calling amreplace(). Otherwise the - * inserted tuple will not have the correct schema. This solves a - * problem with hash-join and merge-sort replace plans. -cim 10/10/90 - * - * targetList: the original target list (including junk attributes). - * length: the length of 'targetList'. - * tupType: the tuple descriptor for the "original" tuple - * (including the junk attributes). - * cleanTargetList: the "clean" target list (junk attributes removed). - * cleanLength: the length of 'cleanTargetList' - * cleanTupTyp: the tuple descriptor of the "clean" tuple (with - * junk attributes removed). - * cleanMap: A map with the correspondance between the non junk - * attributes of the "original" tuple and the - * attributes of the "clean" tuple. - * ---------------- - */ -typedef struct JunkFilter { - NodeTag type; - List *jf_targetList; - int jf_length; - TupleDesc jf_tupType; - List *jf_cleanTargetList; - int jf_cleanLength; - TupleDesc jf_cleanTupType; - AttrNumber *jf_cleanMap; -} JunkFilter; - -/* ---------------- - * EState information - * - * direction direction of the scan - * - * range_table array of scan relation information - * - * result_relation_information for update queries - * - * into_relation_descriptor relation being retrieved "into" - * - * param_list_info information needed to transform - * Param nodes into Const nodes - * - * BaseId during InitPlan(), each node is - * given a number. this is the next - * number to be assigned. - * - * tupleTable this is a pointer to an array - * of pointers to tuples used by - * the executor at any given moment. - * - * junkFilter contains information used to - * extract junk attributes from a tuple. - * (see JunkFilter above) - * - * refcount local buffer refcounts used in - * an ExecMain cycle. this is introduced - * to avoid ExecStart's unpinning each - * other's buffers when called recursively - * ---------------- - */ -typedef struct EState { - NodeTag type; - ScanDirection es_direction; - List *es_range_table; - RelationInfo *es_result_relation_info; - Relation es_into_relation_descriptor; - ParamListInfo es_param_list_info; - int es_BaseId; - TupleTable es_tupleTable; - JunkFilter *es_junkFilter; - int *es_refcount; -} EState; - -/* ---------------- - * Executor Type information needed by plannodes.h - * - *| Note: the bogus classes CommonState and CommonScanState exist only - *| because our inheritance system only allows single inheritance - *| and we have to have unique slot names. Hence two or more - *| classes which want to have a common slot must ALL inherit - *| the slot from some other class. (This is a big hack to - *| allow our classes to share slot names..) - *| - *| Example: - *| the class Result and the class NestLoop nodes both want - *| a slot called "OuterTuple" so they both have to inherit - *| it from some other class. In this case they inherit - *| it from CommonState. "CommonState" and "CommonScanState" are - *| the best names I could come up with for this sort of - *| stuff. - *| - *| As a result, many classes have extra slots which they - *| don't use. These slots are denoted (unused) in the - *| comment preceeding the class definition. If you - *| comes up with a better idea of a way of doing things - *| along these lines, then feel free to make your idea - *| known to me.. -cim 10/15/89 - * ---------------- - */ - -/* ---------------------------------------------------------------- - * Common Executor State Information - * ---------------------------------------------------------------- - */ - -/* BaseNode removed -- base_id moved into CommonState - jolly */ - -/* ---------------- - * CommonState information - * - *| this is a bogus class used to hold slots so other - *| nodes can inherit them... - * - * OuterTupleSlot pointer to slot containing current "outer" tuple - * ResultTupleSlot pointer to slot in tuple table for projected tuple - * ExprContext node's current expression context - * ProjInfo info this node uses to form tuple projections - * NumScanAttributes size of ScanAttributes array - * ScanAttributes attribute numbers of interest in this tuple - * - * ---------------- - */ -typedef struct CommonState { - NodeTag type; /* its first field is NodeTag */ - int cs_base_id; - TupleTableSlot *cs_OuterTupleSlot; - TupleTableSlot *cs_ResultTupleSlot; - ExprContext *cs_ExprContext; - ProjectionInfo *cs_ProjInfo; - bool cs_TupFromTlist; -} CommonState; - - -/* ---------------------------------------------------------------- - * Control Node State Information - * ---------------------------------------------------------------- - */ - -/* ---------------- - * ResultState information - * - * done flag which tells us to quit when we - * have already returned a constant tuple. - * - * CommonState information - * - * OuterTupleSlot pointer to slot containing current "outer" tuple - * ResultTupleSlot pointer to slot in tuple table for projected tuple - * ExprContext node's current expression context - * ProjInfo info this node uses to form tuple projections - * NumScanAttributes size of ScanAttributes array - * ScanAttributes attribute numbers of interest in this tuple - * ---------------- - */ -typedef struct ResultState { - CommonState cstate; /* its first field is NodeTag */ - int rs_done; -} ResultState; - -/* ---------------- - * AppendState information - * - * append nodes have this field "unionplans" which is this - * list of plans to execute in sequence.. these variables - * keep track of things.. - * - * whichplan which plan is being executed - * nplans how many plans are in the list - * initialized array of ExecInitNode() results - * rtentries range table for the current plan - * result_relation_info_list array of each subplan's result relation info - * junkFilter_list array of each subplan's junk filter - * - * CommonState information - * - * OuterTupleSlot pointer to slot containing current "outer" tuple - * ResultTupleSlot pointer to slot in tuple table for projected tuple - * ExprContext node's current expression context - * ProjInfo info this node uses to form tuple projections - * NumScanAttributes size of ScanAttributes array - * ScanAttributes attribute numbers of interest in this tuple - * ---------------- - */ -typedef struct AppendState { - CommonState cstate; /* its first field is NodeTag */ - int as_whichplan; - int as_nplans; - bool *as_initialized; - List *as_rtentries; - List *as_result_relation_info_list; - List *as_junkFilter_list; -} AppendState; - -/* ---------------------------------------------------------------- - * Scan State Information - * ---------------------------------------------------------------- - */ - -/* ---------------- - * CommonScanState information - * - * CommonScanState is a class like CommonState, but is used more - * by the nodes like SeqScan and Sort which want to - * keep track of an underlying relation. - * - * currentRelation relation being scanned - * currentScanDesc current scan descriptor for scan - * ScanTupleSlot pointer to slot in tuple table holding scan tuple - * - * CommonState information - * - * OuterTupleSlot pointer to slot containing current "outer" tuple - * ResultTupleSlot pointer to slot in tuple table for projected tuple - * ExprContext node's current expression context - * ProjInfo info this node uses to form tuple projections - * NumScanAttributes size of ScanAttributes array - * ScanAttributes attribute numbers of interest in this tuple - * ---------------- - */ -typedef struct CommonScanState { - CommonState cstate; /* its first field is NodeTag */ - Relation css_currentRelation; - HeapScanDesc css_currentScanDesc; - TupleTableSlot *css_ScanTupleSlot; -} CommonScanState; - -/* ---------------- - * IndexScanState information - * - *| index scans don't use CommonScanState because - *| the underlying AM abstractions for heap scans and - *| index scans are too different.. It would be nice - *| if the current abstraction was more useful but ... -cim 10/15/89 - * - * IndexPtr current index in use - * NumIndices number of indices in this scan - * ScanKeys Skey structures to scan index rels - * NumScanKeys array of no of keys in each Skey struct - * RuntimeKeyInfo array of array of flags for Skeys evaled at runtime - * RelationDescs ptr to array of relation descriptors - * ScanDescs ptr to array of scan descriptors - * - * CommonState information - * - * OuterTupleSlot pointer to slot containing current "outer" tuple - * ResultTupleSlot pointer to slot in tuple table for projected tuple - * ExprContext node's current expression context - * ProjInfo info this node uses to form tuple projections - * NumScanAttributes size of ScanAttributes array - * ScanAttributes attribute numbers of interest in this tuple - * ---------------- - */ -typedef struct IndexScanState { - CommonState cstate; /* its first field is NodeTag */ - int iss_NumIndices; - int iss_IndexPtr; - ScanKey *iss_ScanKeys; - int *iss_NumScanKeys; - Pointer iss_RuntimeKeyInfo; - RelationPtr iss_RelationDescs; - IndexScanDescPtr iss_ScanDescs; -} IndexScanState; - - -/* ---------------------------------------------------------------- - * Join State Information - * ---------------------------------------------------------------- - */ - -/* ---------------- - * JoinState information - * - * CommonState information - * - * OuterTupleSlot pointer to slot containing current "outer" tuple - * ResultTupleSlot pointer to slot in tuple table for projected tuple - * ExprContext node's current expression context - * ProjInfo info this node uses to form tuple projections - * NumScanAttributes size of ScanAttributes array - * ScanAttributes attribute numbers of interest in this tuple - * ---------------- - */ -typedef CommonState JoinState; - -/* ---------------- - * NestLoopState information - * - * PortalFlag Set to enable portals to work. - * - * JoinState information - * - * CommonState information - * - * OuterTupleSlot pointer to slot containing current "outer" tuple - * ResultTupleSlot pointer to slot in tuple table for projected tuple - * ExprContext node's current expression context - * ProjInfo info this node uses to form tuple projections - * NumScanAttributes size of ScanAttributes array - * ScanAttributes attribute numbers of interest in this tuple - * ---------------- - */ -typedef struct NestLoopState { - JoinState jstate; /* its first field is NodeTag */ - bool nl_PortalFlag; -} NestLoopState; - -/* ---------------- - * MergeJoinState information - * - * OSortopI outerKey1 sortOp innerKey1 ... - * ISortopO innerkey1 sortOp outerkey1 ... - * JoinState current "state" of join. see executor.h - * MarkedTupleSlot pointer to slot in tuple table for marked tuple - * - * JoinState information - * - * CommonState information - * - * OuterTupleSlot pointer to slot containing current "outer" tuple - * ResultTupleSlot pointer to slot in tuple table for projected tuple - * ExprContext node's current expression context - * ProjInfo info this node uses to form tuple projections - * NumScanAttributes size of ScanAttributes array - * ScanAttributes attribute numbers of interest in this tuple - * ---------------- - */ -typedef struct MergeJoinState { - JoinState jstate; /* its first field is NodeTag */ - List *mj_OSortopI; - List *mj_ISortopO; - int mj_JoinState; - TupleTableSlot *mj_MarkedTupleSlot; -} MergeJoinState; - -/* ---------------- - * HashJoinState information - * - * hj_HashTable address of the hash table for the hashjoin - * hj_HashTableShmId shared memory id of hash table - * hj_CurBucket the current hash bucket that we are searching - * for matches of the current outer tuple - * hj_CurTuple the current matching inner tuple in the - * current hash bucket - * hj_CurOTuple the current matching inner tuple in the - * current hash overflow chain - * hj_InnerHashKey the inner hash key in the hashjoin condition - * hj_OuterBatches file descriptors for outer batches - * hj_InnerBatches file descriptors for inner batches - * hj_OuterReadPos current read position of outer batch - * hj_OuterReadBlk current read block of outer batch - * hj_OuterTupleSlot tuple slot for outer tuples - * hj_HashTupleSlot tuple slot for hashed tuples - * - * - * - * JoinState information - * - * CommonState information - * - * OuterTupleSlot pointer to slot containing current "outer" tuple - * ResultTupleSlot pointer to slot in tuple table for projected tuple - * ExprContext node's current expression context - * ProjInfo info this node uses to form tuple projections - * NumScanAttributes size of ScanAttributes array - * ScanAttributes attribute numbers of interest in this tuple - * ---------------- - */ -typedef struct HashJoinState { - JoinState jstate; /* its first field is NodeTag */ - HashJoinTable hj_HashTable; - IpcMemoryId hj_HashTableShmId; - HashBucket hj_CurBucket; - HeapTuple hj_CurTuple; - OverflowTuple hj_CurOTuple; - Var *hj_InnerHashKey; - File *hj_OuterBatches; - File *hj_InnerBatches; - char *hj_OuterReadPos; - int hj_OuterReadBlk; - TupleTableSlot *hj_OuterTupleSlot; - TupleTableSlot *hj_HashTupleSlot; -} HashJoinState; - - -/* ---------------------------------------------------------------- - * Materialization State Information - * ---------------------------------------------------------------- - */ - -/* ---------------- - * MaterialState information - * - * materialize nodes are used to materialize the results - * of a subplan into a temporary relation. - * - * Flag indicated whether subplan has been materialized - * TempRelation temporary relation containing result of executing - * the subplan. - * - * CommonScanState information - * - * currentRelation relation descriptor of sorted relation - * currentScanDesc current scan descriptor for scan - * ScanTupleSlot pointer to slot in tuple table holding scan tuple - * - * CommonState information - * - * OuterTupleSlot pointer to slot containing current "outer" tuple - * ResultTupleSlot pointer to slot in tuple table for projected tuple - * ExprContext node's current expression context - * ProjInfo info this node uses to form tuple projections - * NumScanAttributes size of ScanAttributes array - * ScanAttributes attribute numbers of interest in this tuple - * ---------------- - */ -typedef struct MaterialState { - CommonScanState csstate; /* its first field is NodeTag */ - bool mat_Flag; - Relation mat_TempRelation; -} MaterialState; - -/* --------------------- - * AggregateState information - * - * done indicated whether aggregate has been materialized - * ------------------------- - */ -typedef struct AggState { - CommonScanState csstate; /* its first field is NodeTag */ - bool agg_done; -} AggState; - -/* --------------------- - * GroupState information - * - * ------------------------- - */ -typedef struct GroupState { - CommonScanState csstate; /* its first field is NodeTag */ - bool grp_useLastTuple; /* last tuple not processed yet */ - bool grp_done; - TupleTableSlot *grp_lastSlot; -} GroupState; - -/* ---------------- - * SortState information - * - *| sort nodes are really just a kind of a scan since - *| we implement sorts by retrieveing the entire subplan - *| into a temp relation, sorting the temp relation into - *| another sorted relation, and then preforming a simple - *| unqualified sequential scan on the sorted relation.. - *| -cim 10/15/89 - * - * Flag indicated whether relation has been sorted - * Keys scan key structures used to keep info on sort keys - * TempRelation temporary relation containing result of executing - * the subplan. - * - * CommonScanState information - * - * currentRelation relation descriptor of sorted relation - * currentScanDesc current scan descriptor for scan - * ScanTupleSlot pointer to slot in tuple table holding scan tuple - * - * CommonState information - * - * OuterTupleSlot pointer to slot containing current "outer" tuple - * ResultTupleSlot pointer to slot in tuple table for projected tuple - * ExprContext node's current expression context - * ProjInfo info this node uses to form tuple projections - * NumScanAttributes size of ScanAttributes array - * ScanAttributes attribute numbers of interest in this tuple - * ---------------- - */ -typedef struct SortState { - CommonScanState csstate; /* its first field is NodeTag */ - bool sort_Flag; - ScanKey sort_Keys; - Relation sort_TempRelation; -} SortState; - -/* ---------------- - * UniqueState information - * - * Unique nodes are used "on top of" sort nodes to discard - * duplicate tuples returned from the sort phase. Basically - * all it does is compare the current tuple from the subplan - * with the previously fetched tuple stored in OuterTuple and - * if the two are identical, then we just fetch another tuple - * from the sort and try again. - * - * CommonState information - * - * OuterTupleSlot pointer to slot containing current "outer" tuple - * ResultTupleSlot pointer to slot in tuple table for projected tuple - * ExprContext node's current expression context - * ProjInfo info this node uses to form tuple projections - * NumScanAttributes size of ScanAttributes array - * ScanAttributes attribute numbers of interest in this tuple - * ---------------- - */ -typedef CommonState UniqueState; - - -/* ---------------- - * HashState information - * - * hashBatches file descriptors for the batches - * - * CommonState information - * - * OuterTupleSlot pointer to slot containing current "outer" tuple - * ResultTupleSlot pointer to slot in tuple table for projected tuple - * ExprContext node's current expression context - * ProjInfo info this node uses to form tuple projections - * NumScanAttributes size of ScanAttributes array - * ScanAttributes attribute numbers of interest in this tuple - * ---------------- - */ -typedef struct HashState { - CommonState cstate; /* its first field is NodeTag */ - File *hashBatches; -} HashState; - -/* ----------------------- - * TeeState information - * leftPlace : next item in the queue unseen by the left parent - * rightPlace : next item in the queue unseen by the right parent - * lastPlace : last item in the queue - * bufferRelname : name of the relation used as the buffer queue - * bufferRel : the relation used as the buffer queue - * mcxt : for now, tee's have their own memory context - * may be cleaned up later if portals are cleaned up - * - * initially, a Tee starts with [left/right]Place variables set to -1. - * on cleanup, queue is free'd when both leftPlace and rightPlace = -1 - * ------------------------- -*/ -typedef struct TeeState { - CommonState cstate; /* its first field is NodeTag */ - int tee_leftPlace; - int tee_rightPlace; - int tee_lastPlace; - char *tee_bufferRelname; - Relation tee_bufferRel; - MemoryContext tee_mcxt; - HeapScanDesc tee_leftScanDesc; - HeapScanDesc tee_rightScanDesc; -} TeeState; - -#endif /* EXECNODES_H */ diff --git a/src/backend/nodes/makefuncs.h b/src/backend/nodes/makefuncs.h deleted file mode 100644 index 4c6b0291674..00000000000 --- a/src/backend/nodes/makefuncs.h +++ /dev/null @@ -1,48 +0,0 @@ -/*------------------------------------------------------------------------- - * - * makefuncs.h-- - * prototypes for the creator functions (for primitive nodes) - * - * - * Copyright (c) 1994, Regents of the University of California - * - * $Id: makefuncs.h,v 1.1.1.1 1996/07/09 06:21:32 scrappy Exp $ - * - *------------------------------------------------------------------------- - */ -#ifndef MAKEFUNC_H -#define MAKEFUNC_H - -#include "access/attnum.h" -#include "catalog/pg_operator.h" -#include "utils/fcache.h" -#include "nodes/primnodes.h" - -extern Oper *makeOper(Oid opno, - Oid opid, - Oid opresulttype, - int opsize, - FunctionCachePtr op_fcache); - -extern Var *makeVar(Index varno, - AttrNumber varattno, - Oid vartype, - Index varnoold, - AttrNumber varoattno); - -extern Resdom *makeResdom(AttrNumber resno, - Oid restype, - int reslen, - char *resname, - Index reskey, - Oid reskeyop, - int resjunk); - -extern Const *makeConst(Oid consttype, - Size constlen, - Datum constvalue, - bool constisnull, - bool constbyval, - bool constisset); - -#endif /* MAKEFUNC_H */ diff --git a/src/backend/nodes/memnodes.h b/src/backend/nodes/memnodes.h deleted file mode 100644 index 35adee0d9c3..00000000000 --- a/src/backend/nodes/memnodes.h +++ /dev/null @@ -1,101 +0,0 @@ -/*------------------------------------------------------------------------- - * - * memnodes.h-- - * POSTGRES memory context node definitions. - * - * - * Copyright (c) 1994, Regents of the University of California - * - * $Id: memnodes.h,v 1.1.1.1 1996/07/09 06:21:32 scrappy Exp $ - * - * XXX the typedefs in this file are different from the other ???nodes.h; - * they are pointers to structures instead of the structures themselves. - * If you're wondering, this is plain laziness. I don't want to touch - * the memory context code which should be revamped altogether some day. - * - ay 10/94 - *------------------------------------------------------------------------- - */ -#ifndef MEMNODES_H -#define MEMNODES_H - -#include "c.h" - -#include "utils/memutils.h" -#include "lib/fstack.h" - -#include "nodes/nodes.h" - -/* - * MemoryContext -- - * A logical context in which memory allocations occur. - * - * The types of memory contexts can be thought of as members of the - * following inheritance hierarchy with properties summarized below. - * - * Node - * | - * MemoryContext___ - * / \ - * GlobalMemory PortalMemoryContext - * / \ - * PortalVariableMemory PortalHeapMemory - * - * Flushed at Flushed at Checkpoints - * Transaction Portal - * Commit Close - * - * GlobalMemory n n n - * PortalVariableMemory n y n - * PortalHeapMemory y y y - */ - -typedef struct MemoryContextMethodsData { - Pointer (*alloc)(); - void (*free_p)(); /* need to use free as a #define, - so can't use free */ - Pointer (*realloc)(); - char* (*getName)(); - void (*dump)(); -} *MemoryContextMethods; - -typedef struct MemoryContext { - NodeTag type; - MemoryContextMethods method; -} *MemoryContext; - -/* think about doing this right some time but we'll have explicit fields - for now -ay 10/94 */ -typedef struct GlobalMemory { - NodeTag type; - MemoryContextMethods method; - AllocSetData setData; - char *name; - OrderedElemData elemData; -} *GlobalMemory; - -typedef MemoryContext *PortalMemoryContext; - -typedef struct PortalVariableMemory { - NodeTag type; - MemoryContextMethods method; - AllocSetData setData; -} *PortalVariableMemory; - -typedef struct PortalHeapMemory { - NodeTag type; - MemoryContextMethods method; - Pointer block; - FixedStackData stackData; -} *PortalHeapMemory; - -/* - * MemoryContextIsValid -- - * True iff memory context is valid. - */ -#define MemoryContextIsValid(context) \ - (IsA(context,MemoryContext) || IsA(context,GlobalMemory) || \ - IsA(context,PortalVariableMemory) || IsA(context,PortalHeapMemory)) - -#endif /* MEMNODES_H */ - - diff --git a/src/backend/nodes/nodeFuncs.h b/src/backend/nodes/nodeFuncs.h deleted file mode 100644 index c725f251779..00000000000 --- a/src/backend/nodes/nodeFuncs.h +++ /dev/null @@ -1,23 +0,0 @@ -/*------------------------------------------------------------------------- - * - * nodeFuncs.h-- - * - * - * - * Copyright (c) 1994, Regents of the University of California - * - * $Id: nodeFuncs.h,v 1.1.1.1 1996/07/09 06:21:32 scrappy Exp $ - * - *------------------------------------------------------------------------- - */ -#ifndef NODEFUNCS_H -#define NODEFUNCS_H - -extern bool single_node(Node *node); -extern bool var_is_outer(Var *var); -extern bool var_is_inner(Var *var); -extern bool var_is_rel(Var *var); -extern Oper *replace_opid(Oper *oper); -extern bool non_null(Expr *c); - -#endif /* NODEFUNCS_H */ diff --git a/src/backend/nodes/nodes.h b/src/backend/nodes/nodes.h deleted file mode 100644 index 7fa9fdb5a93..00000000000 --- a/src/backend/nodes/nodes.h +++ /dev/null @@ -1,299 +0,0 @@ -/*------------------------------------------------------------------------- - * - * nodes.h-- - * Definitions for tagged nodes. - * - * - * Copyright (c) 1994, Regents of the University of California - * - * $Id: nodes.h,v 1.1.1.1 1996/07/09 06:21:33 scrappy Exp $ - * - *------------------------------------------------------------------------- - */ -#ifndef NODES_H -#define NODES_H - -#include "c.h" - -/* - * The first field of every node is NodeTag. Each node created (with makeNode) - * will have one of the following tags as the value of its first field. - * - * Note that the number of the node tags are not contiguous. We left holes - * here so that we can add more tags without changing the existing enum's. - */ -typedef enum NodeTag { - T_Invalid = 0, - - /*--------------------- - * TAGS FOR PLAN NODES (plannodes.h) - *--------------------- - */ - T_Plan = 10, - T_Existential, - T_Result, - T_Append, - T_Scan, - T_SeqScan, - T_IndexScan, - T_Join, - T_NestLoop, - T_MergeJoin, - T_HashJoin, - T_Temp, - T_Material, - T_Sort, - T_Agg, - T_Unique, - T_Hash, - T_Choose, - T_Tee, - T_Group, - - /*--------------------- - * TAGS FOR PRIMITIVE NODES (primnodes.h) - *--------------------- - */ - T_Resdom = 100, - T_Fjoin, - T_Expr, - T_Var, - T_Oper, - T_Const, - T_Param, - T_Aggreg, - T_Func, - T_Array, - T_ArrayRef, - - /*--------------------- - * TAGS FOR INNER PLAN NODES (relation.h) - *--------------------- - */ - T_Rel = 200, - T_Path, - T_IndexPath, - T_JoinPath, - T_MergePath, - T_HashPath, - T_OrderKey, - T_JoinKey, - T_MergeOrder, - T_CInfo, - T_JoinMethod, - T_HInfo, - T_MInfo, - T_JInfo, - T_Iter, - T_Stream, - - /*--------------------- - * TAGS FOR EXECUTOR NODES (execnodes.h) - *--------------------- - */ - T_IndexInfo = 300, - T_RelationInfo, - T_TupleCount, - T_TupleTableSlot, - T_ExprContext, - T_ProjectionInfo, - T_JunkFilter, - T_EState, - T_BaseNode, - T_CommonState, - T_ResultState, - T_AppendState, - T_CommonScanState, - T_ScanState, - T_IndexScanState, - T_JoinState, - T_NestLoopState, - T_MergeJoinState, - T_HashJoinState, - T_MaterialState, - T_AggState, - T_GroupState, - T_SortState, - T_UniqueState, - T_HashState, - T_TeeState, - - /*--------------------- - * TAGS FOR MEMORY NODES (memnodes.h) - *--------------------- - */ - T_MemoryContext = 400, - T_GlobalMemory, - T_PortalMemoryContext, - T_PortalVariableMemory, - T_PortalHeapMemory, - - /*--------------------- - * TAGS FOR VALUE NODES (pg_list.h) - *--------------------- - */ - T_Value = 500, - T_List, - T_Integer, - T_Float, - T_String, - T_Null, - - /*--------------------- - * TAGS FOR PARSE TREE NODES (parsenode.h) - *--------------------- - */ - T_Query = 600, - T_AppendStmt, - T_DeleteStmt, - T_ReplaceStmt, - T_CursorStmt, - T_RetrieveStmt, - T_AddAttrStmt, - T_AggregateStmt, - T_ChangeACLStmt, - T_ClosePortalStmt, - T_ClusterStmt, - T_CopyStmt, - T_CreateStmt, - T_VersionStmt, - T_DefineStmt, - T_DestroyStmt, - T_ExtendStmt, - T_FetchStmt, - T_IndexStmt, - T_MoveStmt, - T_ProcedureStmt, - T_PurgeStmt, - T_RecipeStmt, - T_RemoveFuncStmt, - T_RemoveOperStmt, - T_RemoveStmt, - T_RenameStmt, - T_RuleStmt, - T_NotifyStmt, - T_ListenStmt, - T_TransactionStmt, - T_ViewStmt, - T_LoadStmt, - T_CreatedbStmt, - T_DestroydbStmt, - T_VacuumStmt, - T_ExplainStmt, - - T_A_Expr = 700, - T_Attr, - T_A_Const, - T_ParamNo, - T_Ident, - T_FuncCall, - T_A_Indices, - T_ResTarget, - T_ParamString, - T_TimeRange, - T_RelExpr, - T_SortBy, - T_RangeVar, - T_TypeName, - T_IndexElem, - T_ColumnDef, - T_DefElem, - T_TargetEntry, - T_RangeTblEntry, - T_SortClause, - T_GroupClause -} NodeTag; - -/* - * The first field of a node of any type is gauranteed to be the NodeTag. - * Hence the type of any node can be gotten by casting it to Node. Declaring - * a variable to be of Node * (instead of void *) can also facilitate - * debugging. - */ -typedef struct Node { - NodeTag type; -} Node; - -#define nodeTag(_node_) ((Node*)_node_)->type - -#define makeNode(_node_) (_node_*)newNode(sizeof(_node_),T_##_node_) -#define NodeSetTag(n, t) ((Node *)n)->type = t - -#define IsA(_node_,_tag_) (nodeTag(_node_) == T_##_tag_) - -/* ---------------------------------------------------------------- - * IsA functions (no inheritence any more) - * ---------------------------------------------------------------- - */ -#define IsA_JoinPath(jp) \ - (nodeTag(jp)==T_JoinPath || nodeTag(jp)==T_MergePath || \ - nodeTag(jp)==T_HashPath) - -#define IsA_Join(j) \ - (nodeTag(j)==T_Join || nodeTag(j)==T_NestLoop || \ - nodeTag(j)==T_MergeJoin || nodeTag(j)==T_HashJoin) - -#define IsA_Temp(t) \ - (nodeTag(t)==T_Temp || nodeTag(t)==T_Material || nodeTag(t)==T_Sort || \ - nodeTag(t)==T_Unique) - -/* ---------------------------------------------------------------- - * extern declarations follow - * ---------------------------------------------------------------- - */ - -/* - * nodes/nodes.c - */ -extern Node *newNode(Size size, NodeTag tag); - -/* - * nodes/{outfuncs.c,print.c} - */ -#define nodeDisplay print - -extern char *nodeToString(void *obj); -extern void print(void *obj); - -/* - * nodes/{readfuncs.c,read.c} - */ -extern void *stringToNode(char *str); - -/* - * nodes/copyfuncs.c - */ -extern void *copyObject(void *obj); - -/* - * nodes/equalfuncs.c - */ -extern bool equal(void *a, void *b); - - -/* ---------------- - * I don't know why this is here. Most likely a hack.. - * -cim 6/3/90 - * ---------------- - */ -typedef float Cost; - -/* - * CmdType - - * enums for type of operation to aid debugging - * - * ??? could have put this in parsenodes.h but many files not in the - * optimizer also need this... - */ -typedef enum CmdType { - CMD_UNKNOWN, - CMD_SELECT, /* select stmt (formerly retrieve) */ - CMD_UPDATE, /* update stmt (formerly replace) */ - CMD_INSERT, /* insert stmt (formerly append) */ - CMD_DELETE, - CMD_NOTIFY, - CMD_UTILITY /* cmds like create, destroy, copy, vacuum, etc. */ -} CmdType; - - -#endif /* NODES_H */ diff --git a/src/backend/nodes/params.h b/src/backend/nodes/params.h deleted file mode 100644 index 57ee1a023c3..00000000000 --- a/src/backend/nodes/params.h +++ /dev/null @@ -1,90 +0,0 @@ -/*------------------------------------------------------------------------- - * - * params.h-- - * Declarations/definitions of stuff needed to handle parameterized plans. - * - * - * Copyright (c) 1994, Regents of the University of California - * - * $Id: params.h,v 1.1.1.1 1996/07/09 06:21:33 scrappy Exp $ - * - *------------------------------------------------------------------------- - */ -#ifndef PARAMS_H -#define PARAMS_H - -#include "postgres.h" -#include "access/attnum.h" - -/* ---------------------------------------------------------------- - * - * The following are the possible values for the 'paramkind' - * field of a Param node. - * - * PARAM_NAMED: The parameter has a name, i.e. something - * like `$.salary' or `$.foobar'. - * In this case field `paramname' must be a valid Name. - * and field `paramid' must be == 0. - * - * PARAM_NUM: The parameter has only a numeric identifier, - * i.e. something like `$1', `$2' etc. - * The number is contained in the `parmid' field. - * - * PARAM_NEW: Used in PRS2 rule, similar to PARAM_NAMED. - * The `paramname' & `paramid' refer to the "NEW" tuple - * `paramname' is the attribute name and `paramid' its - * attribute number. - * - * PARAM_OLD: Same as PARAM_NEW, but in this case we refer to - * the "OLD" tuple. - */ - -#define PARAM_NAMED 11 -#define PARAM_NUM 12 -#define PARAM_NEW 13 -#define PARAM_OLD 14 -#define PARAM_INVALID 100 - - -/* ---------------------------------------------------------------- - * ParamListInfo - * - * Information needed in order for the executor to handle - * parameterized plans (you know, $.salary, $.name etc. stuff...). - * - * ParamListInfoData contains information needed when substituting a - * Param node with a Const node. - * - * kind : the kind of parameter. - * name : the parameter name (valid if kind == PARAM_NAMED, - * PARAM_NEW or PARAM_OLD) - * id : the parameter id (valid if kind == PARAM_NUM) - * or the attrno (if kind == PARAM_NEW or PARAM_OLD) - * type : PG_TYPE OID of the value - * length : length in bytes of the value - * isnull : true if & only if the value is null (if true then - * the fields 'length' and 'value' are undefined). - * value : the value that has to be substituted in the place - * of the parameter. - * - * ParamListInfo is to be used as an array of ParamListInfoData - * records. An 'InvalidName' in the name field of such a record - * indicates that this is the last record in the array. - * - * ---------------------------------------------------------------- - */ - -typedef struct ParamListInfoData { - int kind; - char *name; - AttrNumber id; - Oid type; - Size length; - bool isnull; - bool byval; - Datum value; -} ParamListInfoData; - -typedef ParamListInfoData *ParamListInfo; - -#endif /* PARAMS_H */ diff --git a/src/backend/nodes/parsenodes.h b/src/backend/nodes/parsenodes.h deleted file mode 100644 index d8ca5b9243e..00000000000 --- a/src/backend/nodes/parsenodes.h +++ /dev/null @@ -1,736 +0,0 @@ -/*------------------------------------------------------------------------- - * - * parsenodes.h-- - * definitions for parse tree nodes - * - * - * Copyright (c) 1994, Regents of the University of California - * - * $Id: parsenodes.h,v 1.5 1996/08/26 06:30:54 scrappy Exp $ - * - *------------------------------------------------------------------------- - */ -#ifndef PARSENODES_H -#define PARSENODES_H - -#include "nodes/nodes.h" -#include "nodes/pg_list.h" -#include "nodes/primnodes.h" -#include "utils/tqual.h" - -/***************************************************************************** - * Query Tree - *****************************************************************************/ - -/* - * Query - - * all statments are turned into a Query tree (via transformStmt) - * for further processing by the optimizer - * utility statements (i.e. non-optimizable statements) - * have the *utilityStmt field set. - * - * we need the isPortal flag because portal names can be null too; can - * get rid of it if we support CURSOR as a commandType. - * - */ -typedef struct Query { - NodeTag type; - - CmdType commandType; /* select|insert|update|delete|utility */ - - Node *utilityStmt; /* non-null if this is a non-optimizable - statement */ - - int resultRelation; /* target relation (index to rtable) */ - char *into; /* portal (cursor) name */ - bool isPortal; /* is this a retrieve into portal? */ - bool isBinary; /* binary portal? */ - - char *uniqueFlag; /* NULL, '*', or Unique attribute name */ - List *sortClause; /* a list of SortClause's */ - - List *rtable; /* list of range table entries */ - List *targetList; /* target list (of TargetEntry) */ - Node *qual; /* qualifications */ - - List *groupClause; /* list of columns to specified in GROUP BY */ - Node *havingQual; /* qualification of each group */ - - int qry_numAgg; /* number of aggregates in the target list */ - Aggreg **qry_aggs; /* the aggregates */ - - /* internal to planner */ - List *base_relation_list_; /* base relation list */ - List *join_relation_list_; /* list of relations generated by joins */ - bool query_is_archival_; /* archival query flag */ -} Query; - - -/***************************************************************************** - * Other Statements (no optimizations required) - * - * Some of them require a little bit of transformation (which is also - * done by transformStmt). The whole structure is then passed on to - * ProcessUtility (by-passing the optimization step) as the utilityStmt - * field in Query. - *****************************************************************************/ - -/* ---------------------- - * Add Column Statement - * ---------------------- - */ -typedef struct AddAttrStmt { - NodeTag type; - char *relname; /* the relation to add attr */ - bool inh; /* add recursively to children? */ - struct ColumnDef *colDef; /* the attribute definition */ -} AddAttrStmt; - -/* ---------------------- - * Change ACL Statement - * ---------------------- - */ -typedef struct ChangeACLStmt { - NodeTag type; - struct AclItem *aclitem; - unsigned modechg; - List *relNames; -} ChangeACLStmt; - -/* ---------------------- - * Close Portal Statement - * ---------------------- - */ -typedef struct ClosePortalStmt { - NodeTag type; - char *portalname; /* name of the portal (cursor) */ -} ClosePortalStmt; - -/* ---------------------- - * Copy Statement - * ---------------------- - */ -typedef struct CopyStmt { - NodeTag type; - bool binary; /* is a binary copy? */ - char *relname; /* the relation to copy */ - bool oids; /* copy oid's? */ - int direction; /* TO or FROM */ - char *filename; /* if NULL, use stdin/stdout */ - char *delimiter; /* delimiter character, \t by default*/ -} CopyStmt; - -/* ---------------------- - * Create Table Statement - * ---------------------- - */ -typedef enum ArchType { - ARCH_NONE, ARCH_LIGHT, ARCH_HEAVY /* archive mode */ -} ArchType; - -typedef struct CreateStmt { - NodeTag type; - char *relname; /* the relation to create */ - List *tableElts; /* column definitions - list of ColumnDef */ - List *inhRelnames; /* relations to inherit from - list of Value (string) */ - ArchType archiveType; /* archive mode (ARCH_NONE if none */ - int location; /* smgrid (-1 if none) */ - int archiveLoc; /* smgrid (-1 if none) */ -} CreateStmt; - -/* ---------------------- - * Create Version Statement - * ---------------------- - */ -typedef struct VersionStmt { - NodeTag type; - char *relname; /* the new relation */ - int direction; /* FORWARD | BACKWARD */ - char *fromRelname; /* relation to create a version */ - char *date; /* date of the snapshot */ -} VersionStmt; - -/* ---------------------- - * Create {Operator|Type|Aggregate} Statement - * ---------------------- - */ -typedef struct DefineStmt { - NodeTag type; - int defType; /* OPERATOR|P_TYPE|AGGREGATE*/ - char *defname; - List *definition; /* a list of DefElem */ -} DefineStmt; - -/* ---------------------- - * Drop Table Statement - * ---------------------- - */ -typedef struct DestroyStmt { - NodeTag type; - List *relNames; /* relations to be dropped */ -} DestroyStmt; - -/* ---------------------- - * Extend Index Statement - * ---------------------- - */ -typedef struct ExtendStmt { - NodeTag type; - char *idxname; /* name of the index */ - Node *whereClause; /* qualifications */ - List *rangetable; /* range table, filled in - by transformStmt() */ -} ExtendStmt; - -/* ---------------------- - * Begin Recipe Statement - * ---------------------- - */ -typedef struct RecipeStmt { - NodeTag type; - char *recipeName; /* name of the recipe*/ -} RecipeStmt; - -/* ---------------------- - * Fetch Statement - * ---------------------- - */ -typedef struct FetchStmt { - NodeTag type; - int direction; /* FORWARD or BACKWARD */ - int howMany; /* amount to fetch ("ALL" --> 0) */ - char *portalname; /* name of portal (cursor) */ -} FetchStmt; - -/* ---------------------- - * Create Index Statement - * ---------------------- - */ -typedef struct IndexStmt { - NodeTag type; - char *idxname; /* name of the index */ - char *relname; /* name of relation to index on */ - char *accessMethod; /* name of acess methood (eg. btree) */ - List *indexParams; /* a list of IndexElem */ - List *withClause; /* a list of ParamString */ - Node *whereClause; /* qualifications */ - List *rangetable; /* range table, filled in - by transformStmt() */ - bool *lossy; /* is index lossy? */ -} IndexStmt; - -/* ---------------------- - * Move Statement (Not implemented) - * ---------------------- - */ -typedef struct MoveStmt { - NodeTag type; - int direction; /* FORWARD or BACKWARD */ - bool to; - int where; - char *portalname; -} MoveStmt; - -/* ---------------------- - * Create Function Statement - * ---------------------- - */ -typedef struct ProcedureStmt { - NodeTag type; - char *funcname; /* name of function to create */ - List *defArgs; /* list of definitions - a list of strings (as Value *) */ - Node *returnType; /* the return type (as a string or - a TypeName (ie.setof) */ - List *withClause; /* a list of ParamString */ - char *as; /* the SQL statement or filename */ - char *language; /* C or SQL */ -} ProcedureStmt; - -/* ---------------------- - * Purge Statement - * ---------------------- - */ -typedef struct PurgeStmt { - NodeTag type; - char *relname; /* relation to purge */ - char *beforeDate; /* purge before this date */ - char *afterDate; /* purge after this date */ -} PurgeStmt; - -/* ---------------------- - * Drop Function Statement - * ---------------------- - */ -typedef struct RemoveFuncStmt { - NodeTag type; - char *funcname; /* function to drop */ - List *args; /* types of the arguments */ -} RemoveFuncStmt; - -/* ---------------------- - * Drop Operator Statement - * ---------------------- - */ -typedef struct RemoveOperStmt { - NodeTag type; - char *opname; /* operator to drop */ - List *args; /* types of the arguments */ -} RemoveOperStmt; - -/* ---------------------- - * Drop {Aggregate|Type|Index|Rule|View} Statement - * ---------------------- - */ -typedef struct RemoveStmt { - NodeTag type; - int removeType; /* AGGREGATE|P_TYPE|INDEX|RULE|VIEW */ - char *name; /* name to drop */ -} RemoveStmt; - -/* ---------------------- - * Alter Table Statement - * ---------------------- - */ -typedef struct RenameStmt { - NodeTag type; - char *relname; /* relation to be altered */ - bool inh; /* recursively alter children? */ - char *column; /* if NULL, rename the relation name - to the new name. Otherwise, rename - this column name. */ - char *newname; /* the new name */ -} RenameStmt; - -/* ---------------------- - * Create Rule Statement - * ---------------------- - */ -typedef struct RuleStmt { - NodeTag type; - char *rulename; /* name of the rule */ - Node *whereClause; /* qualifications */ - CmdType event; /* RETRIEVE */ - struct Attr *object; /* object affected */ - bool instead; /* is a 'do instead'? */ - List *actions; /* the action statements */ -} RuleStmt; - -/* ---------------------- - * Notify Statement - * ---------------------- - */ -typedef struct NotifyStmt { - NodeTag type; - char *relname; /* relation to notify */ -} NotifyStmt; - -/* ---------------------- - * Listen Statement - * ---------------------- - */ -typedef struct ListenStmt { - NodeTag type; - char *relname; /* relation to listen on */ -} ListenStmt; - -/* ---------------------- - * {Begin|Abort|End} Transaction Statement - * ---------------------- - */ -typedef struct TransactionStmt { - NodeTag type; - int command; /* BEGIN|END|ABORT */ -} TransactionStmt; - -/* ---------------------- - * Create View Statement - * ---------------------- - */ -typedef struct ViewStmt { - NodeTag type; - char *viewname; /* name of the view */ - Query *query; /* the SQL statement */ -} ViewStmt; - -/* ---------------------- - * Load Statement - * ---------------------- - */ -typedef struct LoadStmt { - NodeTag type; - char *filename; /* file to load */ -} LoadStmt; - -/* ---------------------- - * Createdb Statement - * ---------------------- - */ -typedef struct CreatedbStmt { - NodeTag type; - char *dbname; /* database to create */ -} CreatedbStmt; - -/* ---------------------- - * Destroydb Statement - * ---------------------- - */ -typedef struct DestroydbStmt { - NodeTag type; - char *dbname; /* database to drop */ -} DestroydbStmt; - -/* ---------------------- - * Cluster Statement (support pbrown's cluster index implementation) - * ---------------------- - */ -typedef struct ClusterStmt { - NodeTag type; - char *relname; /* relation being indexed */ - char *indexname; /* original index defined */ -} ClusterStmt; - -/* ---------------------- - * Vacuum Statement - * ---------------------- - */ -typedef struct VacuumStmt { - NodeTag type; - char *vacrel; /* table to vacuum */ -} VacuumStmt; - -/* ---------------------- - * Explain Statement - * ---------------------- - */ -typedef struct ExplainStmt { - NodeTag type; - Query *query; /* the query */ - List *options; -} ExplainStmt; - - -/***************************************************************************** - * Optimizable Statements - *****************************************************************************/ - -/* ---------------------- - * Insert Statement - * ---------------------- - */ -typedef struct AppendStmt { - NodeTag type; - char *relname; /* relation to insert into */ - List *cols; /* names of the columns */ - List *exprs; /* the expressions (same order as - the columns) */ - List *fromClause; /* the from clause */ - Node *whereClause; /* qualifications */ -} AppendStmt; - -/* ---------------------- - * Delete Statement - * ---------------------- - */ -typedef struct DeleteStmt { - NodeTag type; - char *relname; /* relation to delete from */ - Node *whereClause; /* qualifications */ -} DeleteStmt; - -/* ---------------------- - * Update Statement - * ---------------------- - */ -typedef struct ReplaceStmt { - NodeTag type; - char *relname; /* relation to update */ - List *targetList; /* the target list (of ResTarget) */ - Node *whereClause; /* qualifications */ - List *fromClause; /* the from clause */ -} ReplaceStmt; - -/* ---------------------- - * Create Cursor Statement - * ---------------------- - */ -typedef struct CursorStmt { - NodeTag type; - char *portalname; /* the portal (cursor) to create */ - bool binary; /* a binary (internal) portal? */ - char *unique; /* NULL, "*", or unique attribute name */ - List *targetList; /* the target list (of ResTarget) */ - List *fromClause; /* the from clause */ - Node *whereClause; /* qualifications */ - List *groupClause; /* group by clause */ - List *orderClause; /* sort clause (a list of SortBy's) */ -} CursorStmt; - -/* ---------------------- - * Select Statement - * ---------------------- - */ -typedef struct RetrieveStmt { - NodeTag type; - char *unique; /* NULL, '*', or unique attribute name */ - char *into; /* name of table (for select into - table) */ - List *targetList; /* the target list (of ResTarget) */ - List *fromClause; /* the from clause */ - Node *whereClause; /* qualifications */ - List *groupClause; /* group by clause */ - Node *havingClause; /* having conditional-expression */ - List *orderClause; /* sort clause (a list of SortBy's) */ -} RetrieveStmt; - - -/**************************************************************************** - * Supporting data structures for Parse Trees - ****************************************************************************/ - -/* - * TypeName - specifies a type in definitions - */ -typedef struct TypeName { - NodeTag type; - char *name; /* name of the type */ - bool setof; /* is a set? */ - List *arrayBounds; /* array bounds */ - int typlen; /* length for char() and varchar() */ -} TypeName; - -/* - * ParamNo - specifies a parameter reference - */ -typedef struct ParamNo { - NodeTag type; - int number; /* the number of the parameter */ - TypeName *typename; /* the typecast */ -} ParamNo; - -/* - * A_Expr - binary expressions - */ -typedef struct A_Expr { - NodeTag type; - int oper; /* type of operation - {OP,OR,AND,NOT,ISNULL,NOTNULL} */ - char *opname; /* name of operator/function */ - Node *lexpr; /* left argument */ - Node *rexpr; /* right argument */ -} A_Expr; - -/* - * Attr - - * specifies an Attribute (ie. a Column); could have nested dots or - * array references. - * - */ -typedef struct Attr { - NodeTag type; - char *relname; /* name of relation (can be "*") */ - ParamNo *paramNo; /* or a parameter */ - List *attrs; /* attributes (possibly nested); - list of Values (strings) */ - List *indirection; /* array refs (list of A_Indices') */ -} Attr; - -/* - * A_Const - a constant expression - */ -typedef struct A_Const { - NodeTag type; - Value val; /* the value (with the tag) */ - TypeName *typename; /* typecast */ -} A_Const; - -/* - * ColumnDef - column definition (used in various creates) - */ -typedef struct ColumnDef { - NodeTag type; - char *colname; /* name of column */ - TypeName *typename; /* type of column */ -} ColumnDef; - -/* - * Ident - - * an identifier (could be an attribute or a relation name). Depending - * on the context at transformStmt time, the identifier is treated as - * either a relation name (in which case, isRel will be set) or an - * attribute (in which case, it will be transformed into an Attr). - */ -typedef struct Ident { - NodeTag type; - char *name; /* its name */ - List *indirection; /* array references */ - bool isRel; /* is a relation - filled in by - transformExpr() */ -} Ident; - -/* - * FuncCall - a function/aggregate invocation - */ -typedef struct FuncCall { - NodeTag type; - char *funcname; /* name of function */ - List *args; /* the arguments (list of exprs) */ -} FuncCall; - -/* - * A_Indices - array reference or bounds ([lidx:uidx] or [uidx]) - */ -typedef struct A_Indices { - NodeTag type; - Node *lidx; /* could be NULL */ - Node *uidx; -} A_Indices; - -/* - * ResTarget - - * result target (used in target list of pre-transformed Parse trees) - */ -typedef struct ResTarget { - NodeTag type; - char *name; /* name of the result column */ - List *indirection; /* array references */ - Node *val; /* the value of the result - (A_Expr or Attr) */ -} ResTarget; - -/* - * ParamString - used in with clauses - */ -typedef struct ParamString { - NodeTag type; - char *name; - char *val; -} ParamString; - -/* - * TimeRange - specifies a time range - */ -typedef struct TimeRange { - NodeTag type; - char *startDate; - char *endDate; /* snapshot if NULL */ -} TimeRange; - -/* - * RelExpr - relation expressions - */ -typedef struct RelExpr { - NodeTag type; - char *relname; /* the relation name */ - bool inh; /* inheritance query */ - TimeRange *timeRange; /* the time range */ -} RelExpr; - -/* - * Sortby - for order by clause - */ -typedef struct SortBy { - NodeTag type; - char *range; - char *name; /* name of column to sort on */ - char *useOp; /* operator to use */ -} SortBy; - -/* - * RangeVar - range variable, used in from clauses - */ -typedef struct RangeVar { - NodeTag type; - RelExpr *relExpr; /* the relation expression */ - char *name; /* the name to be referenced - (optional) */ -} RangeVar; - -/* - * IndexElem - index parameters (used in create index) - */ -typedef struct IndexElem { - NodeTag type; - char *name; /* name of index */ - List *args; /* if not NULL, function index */ - char *class; - TypeName *tname; /* type of index's keys (optional) */ -} IndexElem; - -/* - * DefElem - - * a definition (used in definition lists in the form of defname = arg) - */ -typedef struct DefElem { - NodeTag type; - char *defname; - Node *arg; /* a (Value *) or a (TypeName *) */ -} DefElem; - - -/**************************************************************************** - * Nodes for a Query tree - ****************************************************************************/ - -/* - * TargetEntry - - * a target entry (used in the transformed target list) - * - * one of resdom or fjoin is not NULL. a target list is - * ((<resdom | fjoin> expr) (<resdom | fjoin> expr) ...) - */ -typedef struct TargetEntry { - NodeTag type; - Resdom *resdom; /* fjoin overload this to be a list??*/ - Fjoin *fjoin; - Node *expr; /* can be a list too */ -} TargetEntry; - -/* - * RangeTblEntry - - * used in range tables. Some of the following are only used in one of - * the parsing, optimizing, execution stages. - * - * inFromCl marks those range variables that are listed in the from clause. - * In SQL, the targetlist can only refer to range variables listed in the - * from clause but POSTQUEL allows you to refer to tables not specified, in - * which case a range table entry will be generated. We use POSTQUEL - * semantics which is more powerful. However, we need SQL semantics in - * some cases (eg. when expanding a '*') - */ -typedef struct RangeTblEntry { - NodeTag type; - char *relname; /* real name of the relation */ - TimeRange *timeRange; /* time range */ - char *refname; /* the reference name (specified in - the from clause) */ - Oid relid; - bool inh; /* inheritance? */ - bool archive; /* filled in by plan_archive */ - bool inFromCl; /* comes from From Clause */ - TimeQual timeQual; /* filled in by pg_plan */ -} RangeTblEntry; - -/* - * SortClause - - * used in the sort clause for retrieves and cursors - */ -typedef struct SortClause { - NodeTag type; - Resdom *resdom; /* attributes in tlist to be sorted */ - Oid opoid; /* sort operators */ -} SortClause; - -/* - * GroupClause - - * used in the GROUP BY clause - */ -typedef struct GroupClause { - NodeTag type; - Var *grpAttr; /* attributes to group on */ - Oid grpOpoid; /* the sort operator to use */ -} GroupClause; - -#endif /* PARSENODES_H */ diff --git a/src/backend/nodes/pg_list.h b/src/backend/nodes/pg_list.h deleted file mode 100644 index 84d2645a7c4..00000000000 --- a/src/backend/nodes/pg_list.h +++ /dev/null @@ -1,112 +0,0 @@ -/*------------------------------------------------------------------------- - * - * pg_list.h-- - * POSTGRES generic list package - * - * - * Copyright (c) 1994, Regents of the University of California - * - * $Id: pg_list.h,v 1.2 1996/07/28 06:56:28 scrappy Exp $ - * - *------------------------------------------------------------------------- - */ -#ifndef PG_LIST_H -#define PG_LIST_H - -#include <stdio.h> -#include "c.h" -#include "nodes/nodes.h" - -/* ---------------------------------------------------------------- - * node definitions - * ---------------------------------------------------------------- - */ - -/*---------------------- - * Value node - *---------------------- - */ -typedef struct Value { - NodeTag type; /* tag appropriately (eg. T_String) */ - union ValUnion { - char *str; /* string */ - long ival; - double dval; - } val; -} Value; - -#define intVal(v) (((Value *)v)->val.ival) -#define floatVal(v) (((Value *)v)->val.dval) -#define strVal(v) (((Value *)v)->val.str) - - -/*---------------------- - * List node - *---------------------- - */ -typedef struct List { - NodeTag type; - void *elem; - struct List *next; -} List; - -#define NIL ((List *) NULL) - -/* ---------------- - * accessor macros - * ---------------- - */ -#define lfirst(l) ((l)->elem) -#define lnext(l) ((l)->next) -#define lsecond(l) (lfirst(lnext(l))) - -/* - * foreach - - * a convenience macro which loops through the list - */ -#define foreach(_elt_,_list_) \ - for(_elt_=_list_; _elt_!=NIL;_elt_=lnext(_elt_)) - - -/* - * function prototypes in nodes/list.c - */ -extern int length(List *list); -extern List *append(List *list1, List *list2); -extern List *nconc(List *list1, List *list2); -extern List *lcons(void *datum, List *list); -extern bool member(void *foo, List *bar); -extern Value *makeInteger(long i); -extern Value *makeFloat(double d); -extern Value *makeString(char *str); -extern List *makeList(void *elem, ...); -extern List *lappend(List *list, void *obj); -extern List *lremove(void *elem, List *list); -extern void freeList(List *list); - -extern void *nth(int n, List *l); -extern void set_nth(List *l, int n, void *elem); - -/* hack for now */ -#define lconsi(i,l) lcons((void*)(int)i,l) -#define lfirsti(l) ((int)lfirst(l)) -#define lappendi(l,i) lappend(l,(void*)i) -extern bool intMember(int, List *); -extern List *intAppend(List *list1, List *list2); - -extern List *nreverse(List *); -extern List *set_difference(List *, List *); -extern List *set_differencei(List *, List *); -extern List *LispRemove(void *, List *); -extern List *intLispRemove(int, List *); -extern List *LispUnion(List *foo, List *bar); -extern List *LispUnioni(List *foo, List *bar); -extern bool same(List *foo, List *bar); - -/* should be in nodes.h but needs List */ -extern bool equali(List *a, List *b); - -/* in copyfuncs.c */ -extern List *listCopy(List *); - -#endif /* PG_LIST_H */ diff --git a/src/backend/nodes/plannodes.h b/src/backend/nodes/plannodes.h deleted file mode 100644 index a01a93c7749..00000000000 --- a/src/backend/nodes/plannodes.h +++ /dev/null @@ -1,330 +0,0 @@ -/*------------------------------------------------------------------------- - * - * plannodes.h-- - * definitions for query plan nodes - * - * - * Copyright (c) 1994, Regents of the University of California - * - * $Id: plannodes.h,v 1.1.1.1 1996/07/09 06:21:33 scrappy Exp $ - * - *------------------------------------------------------------------------- - */ -#ifndef PLANNODES_H -#define PLANNODES_H - -#include "postgres.h" - -#include "nodes/nodes.h" -#include "nodes/pg_list.h" -#include "nodes/primnodes.h" - -/* ---------------------------------------------------------------- - * Executor State types are used in the plannode structures - * so we have to include their definitions too. - * - * Node Type node information used by executor - * - * control nodes - * - * Existential ExistentialState exstate; - * Result ResultState resstate; - * Append AppendState unionstate; - * - * scan nodes - * - * Scan *** CommonScanState scanstate; - * IndexScan IndexScanState indxstate; - * - * (*** nodes which inherit Scan also inherit scanstate) - * - * join nodes - * - * NestLoop NestLoopState nlstate; - * MergeJoin MergeJoinState mergestate; - * HashJoin HashJoinState hashjoinstate; - * - * materialize nodes - * - * Material MaterialState matstate; - * Sort SortState sortstate; - * Unique UniqueState uniquestate; - * Hash HashState hashstate; - * - * ---------------------------------------------------------------- - */ -#include "nodes/execnodes.h" /* XXX move executor types elsewhere */ - - -/* ---------------------------------------------------------------- - * node definitions - * ---------------------------------------------------------------- - */ - -/* ---------------- - * Plan node - * ---------------- - */ - -typedef struct Plan { - NodeTag type; - Cost cost; - int plan_size; - int plan_width; - int plan_tupperpage; - EState *state; /* at execution time, state's of individual - nodes point to one EState for the - whole top-level plan */ - List *targetlist; - List *qual; /* Node* or List* ?? */ - struct Plan *lefttree; - struct Plan *righttree; -} Plan; - -/* ---------------- - * these are are defined to avoid confusion problems with "left" - * and "right" and "inner" and "outer". The convention is that - * the "left" plan is the "outer" plan and the "right" plan is - * the inner plan, but these make the code more readable. - * ---------------- - */ -#define innerPlan(node) (((Plan *)(node))->righttree) -#define outerPlan(node) (((Plan *)(node))->lefttree) - - -/* - * =============== - * Top-level nodes - * =============== - */ - -/* all plan nodes "derive" from the Plan structure by having the - Plan structure as the first field. This ensures that everything works - when nodes are cast to Plan's. (node pointers are frequently cast to Plan* - when passed around generically in the executor */ - - -/* ---------------- - * existential node - * ---------------- - */ -typedef Plan Existential; - -/* ---------------- - * result node - - * returns tuples from outer plan that satisfy the qualifications - * ---------------- - */ -typedef struct Result { - Plan plan; - Node *resconstantqual; - ResultState *resstate; -} Result; - -/* ---------------- - * append node - * ---------------- - */ -typedef struct Append { - Plan plan; - List *unionplans; - Index unionrelid; - List *unionrtentries; - AppendState *unionstate; -} Append; - -/* - * ========== - * Scan nodes - * ========== - */ -typedef struct Scan { - Plan plan; - Index scanrelid; /* relid is index into the range table */ - CommonScanState *scanstate; -} Scan; - -/* ---------------- - * sequential scan node - * ---------------- - */ -typedef Scan SeqScan; - -/* ---------------- - * index scan node - * ---------------- - */ -typedef struct IndexScan { - Scan scan; - List *indxid; - List *indxqual; - IndexScanState *indxstate; -} IndexScan; - -/* - * ========== - * Join nodes - * ========== - */ - -/* ---------------- - * Join node - * ---------------- - */ -typedef Plan Join; - -/* ---------------- - * nest loop join node - * ---------------- - */ -typedef struct NestLoop { - Join join; - NestLoopState *nlstate; -} NestLoop; - -/* ---------------- - * merge join node - * ---------------- - */ -typedef struct MergeJoin { - Join join; - List *mergeclauses; - Oid mergesortop; - Oid *mergerightorder; /* inner sort operator */ - Oid *mergeleftorder; /* outer sort operator */ - MergeJoinState *mergestate; -} MergeJoin; - -/* ---------------- - * hash join (probe) node - * ---------------- - */ -typedef struct HashJoin { - Join join; - List *hashclauses; - Oid hashjoinop; - HashJoinState *hashjoinstate; - HashJoinTable hashjointable; - IpcMemoryKey hashjointablekey; - int hashjointablesize; - bool hashdone; -} HashJoin; - -/* --------------- - * aggregate node - * --------------- - */ -typedef struct Agg { - Plan plan; - int numAgg; - Aggreg **aggs; - AggState *aggstate; -} Agg; - -/* --------------- - * group node - - * use for queries with GROUP BY specified. - * - * If tuplePerGroup is true, one tuple (with group columns only) is - * returned for each group and NULL is returned when there are no more - * groups. Otherwise, all the tuples of a group are returned with a - * NULL returned at the end of each group. (see nodeGroup.c for details) - * --------------- - */ -typedef struct Group { - Plan plan; - bool tuplePerGroup; /* what tuples to return (see above) */ - int numCols; /* number of group columns */ - AttrNumber *grpColIdx; /* index into the target list */ - GroupState *grpstate; -} Group; - -/* - * ========== - * Temp nodes - * ========== - */ -typedef struct Temp { - Plan plan; - Oid tempid; - int keycount; -} Temp; - -/* ---------------- - * materialization node - * ---------------- - */ -typedef struct Material { - Plan plan; /* temp node flattened out */ - Oid tempid; - int keycount; - MaterialState *matstate; -} Material; - -/* ---------------- - * sort node - * ---------------- - */ -typedef struct Sort { - Plan plan; /* temp node flattened out */ - Oid tempid; - int keycount; - SortState *sortstate; -} Sort; - -/* ---------------- - * unique node - * ---------------- - */ -typedef struct Unique { - Plan plan; /* temp node flattened out */ - Oid tempid; - int keycount; - char *uniqueAttr; /* NULL if all attrs, - or unique attribute name */ - AttrNumber uniqueAttrNum; /* attribute number of attribute - to select distinct on */ - UniqueState *uniquestate; -} Unique; - -/* ---------------- - * hash build node - * ---------------- - */ -typedef struct Hash { - Plan plan; - Var *hashkey; - HashState *hashstate; - HashJoinTable hashtable; - IpcMemoryKey hashtablekey; - int hashtablesize; -} Hash; - -/* --------------------- - * choose node - * --------------------- - */ -typedef struct Choose { - Plan plan; - List *chooseplanlist; -} Choose; - -/* ------------------- - * Tee node information - * - * leftParent : the left parent of this node - * rightParent: the right parent of this node - * ------------------- -*/ -typedef struct Tee { - Plan plan; - Plan* leftParent; - Plan* rightParent; - TeeState *teestate; - char *teeTableName; /* the name of the table to materialize - the tee into */ - List *rtentries; /* the range table for the plan below the Tee - may be different than the parent plans */ -} Tee; - -#endif /* PLANNODES_H */ diff --git a/src/backend/nodes/primnodes.h b/src/backend/nodes/primnodes.h deleted file mode 100644 index 7ceb9c6101f..00000000000 --- a/src/backend/nodes/primnodes.h +++ /dev/null @@ -1,318 +0,0 @@ -/*------------------------------------------------------------------------- - * - * primnodes.h-- - * Definitions for parse tree/query tree ("primitive") nodes. - * - * - * Copyright (c) 1994, Regents of the University of California - * - * $Id: primnodes.h,v 1.1.1.1 1996/07/09 06:21:33 scrappy Exp $ - * - *------------------------------------------------------------------------- - */ -#ifndef PRIMNODES_H -#define PRIMNODES_H - -#include "postgres.h" - -#include "access/attnum.h" -#include "storage/buf.h" -#include "utils/rel.h" -#include "utils/fcache.h" -#include "nodes/params.h" - -#include "nodes/nodes.h" -#include "nodes/pg_list.h" - -/* ---------------------------------------------------------------- - * node definitions - * ---------------------------------------------------------------- - */ - -/* ---------------- - * Resdom (Result Domain) - * resno - attribute number - * restype - type of the resdom - * reslen - length (in bytes) of the result - * resname - name of the resdom (could be NULL) - * reskey - order of key in a sort (for those > 0) - * reskeyop - sort operator Oid - * resjunk - set to nonzero to eliminate the attribute - * from final target list e.g., ctid for replace - * and delete - * - * ---------------- - */ -typedef struct Resdom { - NodeTag type; - AttrNumber resno; - Oid restype; - int reslen; - char *resname; - Index reskey; - Oid reskeyop; - int resjunk; -} Resdom; - -/* ------------- - * Fjoin - * initialized - true if the Fjoin has already been initialized for - * the current target list evaluation - * nNodes - The number of Iter nodes returning sets that the - * node will flatten - * outerList - 1 or more Iter nodes - * inner - exactly one Iter node. We eval every node in the - * outerList once then eval the inner node to completion - * pair the outerList result vector with each inner - * result to form the full result. When the inner has - * been exhausted, we get the next outer result vector - * and reset the inner. - * results - The complete (flattened) result vector - * alwaysNull - a null vector to indicate sets with a cardinality of - * 0, we treat them as the set {NULL}. - */ -typedef struct Fjoin { - NodeTag type; - bool fj_initialized; - int fj_nNodes; - List *fj_innerNode; - DatumPtr fj_results; - BoolPtr fj_alwaysDone; -} Fjoin; - -/* ---------------- - * Expr - * typeOid - oid of the type of this expression - * opType - type of this expression - * oper - the Oper node if it is an OPER_EXPR or the - * Func node if it is a FUNC_EXPR - * args - arguments to this expression - * ---------------- - */ -typedef enum OpType { - OP_EXPR, FUNC_EXPR, OR_EXPR, AND_EXPR, NOT_EXPR -} OpType; - -typedef struct Expr { - NodeTag type; - Oid typeOid; /* oid of the type of this expr */ - OpType opType; /* type of the op */ - Node *oper; /* could be Oper or Func */ - List *args; /* list of argument nodes */ -} Expr; - -/* ---------------- - * Var - * varno - index of this var's relation in the range table - * (could be INNER or OUTER) - * varattno - attribute number of this var - * vartype - pg_type tuple oid for the type of this var - * varnoold - keep varno around in case it got changed to INNER/ - * OUTER (see match_varid) - * varoattno - attribute number of this var - * [ '(varnoold varoattno) was varid -ay 2/95] - * ---------------- - */ -#define INNER 65000 -#define OUTER 65001 - -#define PRS2_CURRENT_VARNO 1 -#define PRS2_NEW_VARNO 2 - -typedef struct Var { - NodeTag type; - Index varno; - AttrNumber varattno; - Oid vartype; - Index varnoold; /* only used by optimizer */ - AttrNumber varoattno; /* only used by optimizer */ -} Var; - -/* ---------------- - * Oper - * opno - PG_OPERATOR OID of the operator - * opid - PG_PROC OID for the operator - * opresulttype - PG_TYPE OID of the operator's return value - * opsize - size of return result (cached by executor) - * op_fcache - XXX comment me. - * - * ---- - * NOTE: in the good old days 'opno' used to be both (or either, or - * neither) the pg_operator oid, and/or the pg_proc oid depending - * on the postgres module in question (parser->pg_operator, - * executor->pg_proc, planner->both), the mood of the programmer, - * and the phase of the moon (rumors that it was also depending on the day - * of the week are probably false). To make things even more postgres-like - * (i.e. a mess) some comments were referring to 'opno' using the name - * 'opid'. Anyway, now we have two separate fields, and of course that - * immediately removes all bugs from the code... [ sp :-) ]. - * ---------------- - */ -typedef struct Oper { - NodeTag type; - Oid opno; - Oid opid; - Oid opresulttype; - int opsize; - FunctionCachePtr op_fcache; -} Oper; - - -/* ---------------- - * Const - * consttype - PG_TYPE OID of the constant's value - * constlen - length in bytes of the constant's value - * constvalue - the constant's value - * constisnull - whether the constant is null - * (if true, the other fields are undefined) - * constbyval - whether the information in constvalue - * if passed by value. If true, then all the information - * is stored in the datum. If false, then the datum - * contains a pointer to the information. - * constisset - whether the const represents a set. The const - * value corresponding will be the query that defines - * the set. - * ---------------- - */ -typedef struct Const { - NodeTag type; - Oid consttype; - Size constlen; - Datum constvalue; - bool constisnull; - bool constbyval; - bool constisset; -} Const; - -/* ---------------- - * Param - * paramkind - specifies the kind of parameter. The possible values - * for this field are specified in "params.h", and they are: - * - * PARAM_NAMED: The parameter has a name, i.e. something - * like `$.salary' or `$.foobar'. - * In this case field `paramname' must be a valid Name. - * - * PARAM_NUM: The parameter has only a numeric identifier, - * i.e. something like `$1', `$2' etc. - * The number is contained in the `paramid' field. - * - * PARAM_NEW: Used in PRS2 rule, similar to PARAM_NAMED. - * The `paramname' and `paramid' refer to the "NEW" tuple - * The `pramname' is the attribute name and `paramid' - * is the attribute number. - * - * PARAM_OLD: Same as PARAM_NEW, but in this case we refer to - * the "OLD" tuple. - * - * paramid - numeric identifier for literal-constant parameters ("$1") - * paramname - attribute name for tuple-substitution parameters ("$.foo") - * paramtype - PG_TYPE OID of the parameter's value - * param_tlist - allows for projection in a param node. - * ---------------- - */ -typedef struct Param { - NodeTag type; - int paramkind; - AttrNumber paramid; - char *paramname; - Oid paramtype; - List *param_tlist; -} Param; - - -/* ---------------- - * Func - * funcid - PG_FUNCTION OID of the function - * functype - PG_TYPE OID of the function's return value - * funcisindex - the function can be evaluated by scanning an index - * (set during query optimization) - * funcsize - size of return result (cached by executor) - * func_fcache - runtime state while running this function. Where - * we are in the execution of the function if it - * returns more than one value, etc. - * See utils/fcache.h - * func_tlist - projection of functions returning tuples - * func_planlist - result of planning this func, if it's a PQ func - * ---------------- - */ -typedef struct Func { - NodeTag type; - Oid funcid; - Oid functype; - bool funcisindex; - int funcsize; - FunctionCachePtr func_fcache; - List *func_tlist; - List *func_planlist; -} Func; - -/* ---------------- - * Aggreg - * aggname - name of the aggregate - * basetype - base type Oid of the aggregate - * aggtype - type Oid of final result of the aggregate - * query - XXX comment me - * target - XXX comment me - * ---------------- - */ -typedef struct Aggreg { - NodeTag type; - char *aggname; - Oid basetype; /* base type of the aggregate */ - Oid aggtype; /* type of final result */ - Node *target; /* attribute to aggreg on */ - int aggno; /* index to ecxt_values */ -} Aggreg; - -/* ---------------- - * Array - * arrayelemtype - base type of the array's elements (homogenous!) - * arrayelemlength - length of that type - * arrayelembyval - can you pass this element by value? - * arrayndim - number of dimensions of the array - * arraylow - base for array indexing - * arrayhigh - limit for array indexing - * arraylen - - * ---------------- - * - * memo from mao: the array support we inherited from 3.1 is just - * wrong. when time exists, we should redesign this stuff to get - * around a bunch of unfortunate implementation decisions made there. - */ -typedef struct Array { - NodeTag type; - Oid arrayelemtype; - int arrayelemlength; - bool arrayelembyval; - int arrayndim; - IntArray arraylow; - IntArray arrayhigh; - int arraylen; -} Array; - -/* ---------------- - * ArrayRef: - * refelemtype - type of the element referenced here - * refelemlength - length of that type - * refelembyval - can you pass this element type by value? - * refupperindexpr - expressions that evaluate to upper array index - * reflowerexpr- the expressions that evaluate to a lower array index - * refexpr - the expression that evaluates to an array - * refassignexpr- the expression that evaluates to the new value - * to be assigned to the array in case of replace. - * ---------------- - */ -typedef struct ArrayRef { - NodeTag type; - int refattrlength; - int refelemlength; - Oid refelemtype; - bool refelembyval; - List *refupperindexpr; - List *reflowerindexpr; - Node *refexpr; - Node *refassgnexpr; -} ArrayRef; - -#endif /* PRIMNODES_H */ diff --git a/src/backend/nodes/readfuncs.h b/src/backend/nodes/readfuncs.h deleted file mode 100644 index 727114a84c9..00000000000 --- a/src/backend/nodes/readfuncs.h +++ /dev/null @@ -1,27 +0,0 @@ -/*------------------------------------------------------------------------- - * - * readfuncs.h-- - * header file for read.c and readfuncs.c. These functions are internal - * to the stringToNode interface and should not be used by anyone else. - * - * Copyright (c) 1994, Regents of the University of California - * - * $Id: readfuncs.h,v 1.1.1.1 1996/07/09 06:21:33 scrappy Exp $ - * - *------------------------------------------------------------------------- - */ -#ifndef READFUNCS_H -#define READFUNCS_H - -/* - * prototypes for functions in read.c (the lisp token parser) - */ -extern char *lsptok(char *string, int *length); -extern void *nodeRead(bool read_car_only); - -/* - * prototypes for functions in readfuncs.c - */ -extern Node *parsePlanString(); - -#endif /* READFUNCS_H */ diff --git a/src/backend/nodes/relation.h b/src/backend/nodes/relation.h deleted file mode 100644 index fda32d76945..00000000000 --- a/src/backend/nodes/relation.h +++ /dev/null @@ -1,279 +0,0 @@ -/*------------------------------------------------------------------------- - * - * relation.h-- - * Definitions for internal planner nodes. - * - * - * Copyright (c) 1994, Regents of the University of California - * - * $Id: relation.h,v 1.1.1.1 1996/07/09 06:21:33 scrappy Exp $ - * - *------------------------------------------------------------------------- - */ -#ifndef RELATION_H -#define RELATION_H - -#include "c.h" -#include "nodes/pg_list.h" -#include "nodes/primnodes.h" -#include "nodes/parsenodes.h" -#include "nodes/nodes.h" - -/* - * Relid - * List of relation identifiers (indexes into the rangetable). - */ - -typedef List *Relid; - -/* - * Rel - * Per-base-relation information - * - * Parts of this data structure are specific to various scan and join - * mechanisms. It didn't seem worth creating new node types for them. - * - * relids - List of relation indentifiers - * indexed - true if the relation has secondary indices - * pages - number of pages in the relation - * tuples - number of tuples in the relation - * size - number of tuples in the relation after restrictions clauses - * have been applied - * width - number of bytes per tuple in the relation after the - * appropriate projections have been done - * targetlist - List of TargetList nodes - * pathlist - List of Path nodes, one for each possible method of - * generating the relation - * unorderedpath - a Path node generating this relation whose resulting - * tuples are unordered (this isn't necessarily a - * sequential scan path, e.g., scanning with a hash index - * leaves the tuples unordered) - * cheapestpath - least expensive Path (regardless of final order) - * pruneable - flag to let the planner know whether it can prune the plan - * space of this Rel or not. -- JMH, 11/11/92 - * - * * If the relation is a (secondary) index it will have the following - * three fields: - * - * classlist - List of PG_AMOPCLASS OIDs for the index - * indexkeys - List of base-relation attribute numbers that are index keys - * ordering - List of PG_OPERATOR OIDs which order the indexscan result - * relam - the OID of the pg_am of the index - * - * * The presence of the remaining fields depends on the restrictions - * and joins which the relation participates in: - * - * clauseinfo - List of ClauseInfo nodes, containing info about each - * qualification clause in which this relation participates - * joininfo - List of JoinInfo nodes, containing info about each join - * clause in which this relation participates - * innerjoin - List of Path nodes that represent indices that may be used - * as inner paths of nestloop joins - * - * NB. the last element of the arrays classlist, indexkeys and ordering - * is always 0. 2/95 - ay - */ - -typedef struct Rel { - NodeTag type; - - /* all relations: */ - Relid relids; - - /* catalog statistics information */ - bool indexed; - int pages; - int tuples; - int size; - int width; - - /* materialization information */ - List *targetlist; - List *pathlist; - struct Path *unorderedpath; - struct Path *cheapestpath; - bool pruneable; - - /* used solely by indices: */ - Oid *classlist; /* classes of AM operators */ - int *indexkeys; /* keys over which we're indexing */ - Oid relam; /* OID of the access method (in pg_am) */ - - Oid indproc; - List *indpred; - - /* used by various scans and joins: */ - Oid *ordering; /* OID of operators in sort order */ - List *clauseinfo; /* restriction clauses */ - List *joininfo; /* join clauses */ - List *innerjoin; - List *superrels; -} Rel; - -extern Var *get_expr(TargetEntry *foo); - -typedef struct MergeOrder { - NodeTag type; - Oid join_operator; - Oid left_operator; - Oid right_operator; - Oid left_type; - Oid right_type; -} MergeOrder; - -typedef enum OrderType { - MERGE_ORDER, SORTOP_ORDER -} OrderType; - -typedef struct PathOrder { - OrderType ordtype; - union { - Oid *sortop; - MergeOrder *merge; - } ord; -} PathOrder; - -typedef struct Path { - NodeTag type; - - Rel *parent; - Cost path_cost; - - NodeTag pathtype; - - PathOrder p_ordering; - - List *keys; - Cost outerjoincost; - Relid joinid; - List *locclauseinfo; -} Path; - -typedef struct IndexPath { - Path path; - List *indexid; - List *indexqual; -} IndexPath; - -typedef struct JoinPath { - Path path; - List *pathclauseinfo; - Path *outerjoinpath; - Path *innerjoinpath; -} JoinPath; - -typedef struct MergePath { - JoinPath jpath; - List *path_mergeclauses; - List *outersortkeys; - List *innersortkeys; -} MergePath; - -typedef struct HashPath { - JoinPath jpath; - List *path_hashclauses; - List *outerhashkeys; - List *innerhashkeys; -} HashPath; - -/****** - * Keys - ******/ - -typedef struct OrderKey { - NodeTag type; - int attribute_number; - Index array_index; -} OrderKey; - -typedef struct JoinKey { - NodeTag type; - Var *outer; - Var *inner; -} JoinKey; - -/******* - * clause info - *******/ - -typedef struct CInfo { - NodeTag type; - Expr *clause; /* should be an OP clause */ - Cost selectivity; - bool notclause; - List *indexids; - - /* mergesort only */ - MergeOrder *mergesortorder; - - /* hashjoin only */ - Oid hashjoinoperator; - Relid cinfojoinid; -} CInfo; - -typedef struct JoinMethod { - NodeTag type; - List *jmkeys; - List *clauses; -} JoinMethod; - -typedef struct HInfo { - JoinMethod jmethod; - Oid hashop; -} HInfo; - -typedef struct MInfo { - JoinMethod jmethod; - MergeOrder *m_ordering; -} MInfo; - -typedef struct JInfo { - NodeTag type; - List *otherrels; - List *jinfoclauseinfo; - bool mergesortable; - bool hashjoinable; - bool inactive; -} JInfo; - -typedef struct Iter { - NodeTag type; - Node *iterexpr; - Oid itertype; /* type of the iter expr (use for type - checking) */ -} Iter; - -/* -** Stream: -** A stream represents a root-to-leaf path in a plan tree (i.e. a tree of -** JoinPaths and Paths). The stream includes pointers to all Path nodes, -** as well as to any clauses that reside above Path nodes. This structure -** is used to make Path nodes and clauses look similar, so that Predicate -** Migration can run. -** -** pathptr -- pointer to the current path node -** cinfo -- if NULL, this stream node referes to the path node. -** Otherwise this is a pointer to the current clause. -** clausetype -- whether cinfo is in locclauseinfo or pathclauseinfo in the -** path node -** upstream -- linked list pointer upwards -** downstream -- ditto, downwards -** groupup -- whether or not this node is in a group with the node upstream -** groupcost -- total cost of the group that node is in -** groupsel -- total selectivity of the group that node is in -*/ -typedef struct Stream *StreamPtr; - -typedef struct Stream { - NodeTag type; - Path *pathptr; - CInfo *cinfo; - int *clausetype; - struct Stream *upstream; - struct Stream *downstream; - bool groupup; - Cost groupcost; - Cost groupsel; -} Stream; - -#endif /* RELATION_H */ |
