init
This commit is contained in:
96
pg_include/nodes/bitmapset.h
Executable file
96
pg_include/nodes/bitmapset.h
Executable file
@@ -0,0 +1,96 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* bitmapset.h
|
||||
* PostgreSQL generic bitmap set package
|
||||
*
|
||||
* A bitmap set can represent any set of nonnegative integers, although
|
||||
* it is mainly intended for sets where the maximum value is not large,
|
||||
* say at most a few hundred. By convention, a NULL pointer is always
|
||||
* accepted by all operations to represent the empty set. (But beware
|
||||
* that this is not the only representation of the empty set. Use
|
||||
* bms_is_empty() in preference to testing for NULL.)
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2003-2012, PostgreSQL Global Development Group
|
||||
*
|
||||
* src/include/nodes/bitmapset.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef BITMAPSET_H
|
||||
#define BITMAPSET_H
|
||||
|
||||
/*
|
||||
* Data representation
|
||||
*/
|
||||
|
||||
/* The unit size can be adjusted by changing these three declarations: */
|
||||
#define BITS_PER_BITMAPWORD 32
|
||||
typedef uint32 bitmapword; /* must be an unsigned type */
|
||||
typedef int32 signedbitmapword; /* must be the matching signed type */
|
||||
|
||||
typedef struct Bitmapset
|
||||
{
|
||||
int nwords; /* number of words in array */
|
||||
bitmapword words[1]; /* really [nwords] */
|
||||
} Bitmapset; /* VARIABLE LENGTH STRUCT */
|
||||
|
||||
|
||||
/* result of bms_subset_compare */
|
||||
typedef enum
|
||||
{
|
||||
BMS_EQUAL, /* sets are equal */
|
||||
BMS_SUBSET1, /* first set is a subset of the second */
|
||||
BMS_SUBSET2, /* second set is a subset of the first */
|
||||
BMS_DIFFERENT /* neither set is a subset of the other */
|
||||
} BMS_Comparison;
|
||||
|
||||
/* result of bms_membership */
|
||||
typedef enum
|
||||
{
|
||||
BMS_EMPTY_SET, /* 0 members */
|
||||
BMS_SINGLETON, /* 1 member */
|
||||
BMS_MULTIPLE /* >1 member */
|
||||
} BMS_Membership;
|
||||
|
||||
|
||||
/*
|
||||
* function prototypes in nodes/bitmapset.c
|
||||
*/
|
||||
|
||||
extern Bitmapset *bms_copy(const Bitmapset *a);
|
||||
extern bool bms_equal(const Bitmapset *a, const Bitmapset *b);
|
||||
extern Bitmapset *bms_make_singleton(int x);
|
||||
extern void bms_free(Bitmapset *a);
|
||||
|
||||
extern Bitmapset *bms_union(const Bitmapset *a, const Bitmapset *b);
|
||||
extern Bitmapset *bms_intersect(const Bitmapset *a, const Bitmapset *b);
|
||||
extern Bitmapset *bms_difference(const Bitmapset *a, const Bitmapset *b);
|
||||
extern bool bms_is_subset(const Bitmapset *a, const Bitmapset *b);
|
||||
extern BMS_Comparison bms_subset_compare(const Bitmapset *a, const Bitmapset *b);
|
||||
extern bool bms_is_member(int x, const Bitmapset *a);
|
||||
extern bool bms_overlap(const Bitmapset *a, const Bitmapset *b);
|
||||
extern bool bms_nonempty_difference(const Bitmapset *a, const Bitmapset *b);
|
||||
extern int bms_singleton_member(const Bitmapset *a);
|
||||
extern int bms_num_members(const Bitmapset *a);
|
||||
|
||||
/* optimized tests when we don't need to know exact membership count: */
|
||||
extern BMS_Membership bms_membership(const Bitmapset *a);
|
||||
extern bool bms_is_empty(const Bitmapset *a);
|
||||
|
||||
/* these routines recycle (modify or free) their non-const inputs: */
|
||||
|
||||
extern Bitmapset *bms_add_member(Bitmapset *a, int x);
|
||||
extern Bitmapset *bms_del_member(Bitmapset *a, int x);
|
||||
extern Bitmapset *bms_add_members(Bitmapset *a, const Bitmapset *b);
|
||||
extern Bitmapset *bms_int_members(Bitmapset *a, const Bitmapset *b);
|
||||
extern Bitmapset *bms_del_members(Bitmapset *a, const Bitmapset *b);
|
||||
extern Bitmapset *bms_join(Bitmapset *a, Bitmapset *b);
|
||||
|
||||
/* support for iterating through the integer elements of a set: */
|
||||
extern int bms_first_member(Bitmapset *a);
|
||||
|
||||
/* support for hashtables using Bitmapsets as keys: */
|
||||
extern uint32 bms_hash_value(const Bitmapset *a);
|
||||
|
||||
#endif /* BITMAPSET_H */
|
||||
1877
pg_include/nodes/execnodes.h
Executable file
1877
pg_include/nodes/execnodes.h
Executable file
File diff suppressed because it is too large
Load Diff
82
pg_include/nodes/makefuncs.h
Executable file
82
pg_include/nodes/makefuncs.h
Executable file
@@ -0,0 +1,82 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* makefuncs.h
|
||||
* prototypes for the creator functions (for primitive nodes)
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/nodes/makefuncs.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef MAKEFUNC_H
|
||||
#define MAKEFUNC_H
|
||||
|
||||
#include "nodes/parsenodes.h"
|
||||
|
||||
|
||||
extern A_Expr *makeA_Expr(A_Expr_Kind kind, List *name,
|
||||
Node *lexpr, Node *rexpr, int location);
|
||||
|
||||
extern A_Expr *makeSimpleA_Expr(A_Expr_Kind kind, char *name,
|
||||
Node *lexpr, Node *rexpr, int location);
|
||||
|
||||
extern Var *makeVar(Index varno,
|
||||
AttrNumber varattno,
|
||||
Oid vartype,
|
||||
int32 vartypmod,
|
||||
Oid varcollid,
|
||||
Index varlevelsup);
|
||||
|
||||
extern Var *makeVarFromTargetEntry(Index varno,
|
||||
TargetEntry *tle);
|
||||
|
||||
extern Var *makeWholeRowVar(RangeTblEntry *rte,
|
||||
Index varno,
|
||||
Index varlevelsup,
|
||||
bool allowScalar);
|
||||
|
||||
extern TargetEntry *makeTargetEntry(Expr *expr,
|
||||
AttrNumber resno,
|
||||
char *resname,
|
||||
bool resjunk);
|
||||
|
||||
extern TargetEntry *flatCopyTargetEntry(TargetEntry *src_tle);
|
||||
|
||||
extern FromExpr *makeFromExpr(List *fromlist, Node *quals);
|
||||
|
||||
extern Const *makeConst(Oid consttype,
|
||||
int32 consttypmod,
|
||||
Oid constcollid,
|
||||
int constlen,
|
||||
Datum constvalue,
|
||||
bool constisnull,
|
||||
bool constbyval);
|
||||
|
||||
extern Const *makeNullConst(Oid consttype, int32 consttypmod, Oid constcollid);
|
||||
|
||||
extern Node *makeBoolConst(bool value, bool isnull);
|
||||
|
||||
extern Expr *makeBoolExpr(BoolExprType boolop, List *args, int location);
|
||||
|
||||
extern Alias *makeAlias(const char *aliasname, List *colnames);
|
||||
|
||||
extern RelabelType *makeRelabelType(Expr *arg, Oid rtype, int32 rtypmod,
|
||||
Oid rcollid, CoercionForm rformat);
|
||||
|
||||
extern RangeVar *makeRangeVar(char *schemaname, char *relname, int location);
|
||||
|
||||
extern TypeName *makeTypeName(char *typnam);
|
||||
extern TypeName *makeTypeNameFromNameList(List *names);
|
||||
extern TypeName *makeTypeNameFromOid(Oid typeOid, int32 typmod);
|
||||
|
||||
extern FuncExpr *makeFuncExpr(Oid funcid, Oid rettype, List *args,
|
||||
Oid funccollid, Oid inputcollid, CoercionForm fformat);
|
||||
|
||||
extern DefElem *makeDefElem(char *name, Node *arg);
|
||||
extern DefElem *makeDefElemExtended(char *nameSpace, char *name, Node *arg,
|
||||
DefElemAction defaction);
|
||||
|
||||
#endif /* MAKEFUNC_H */
|
||||
78
pg_include/nodes/memnodes.h
Executable file
78
pg_include/nodes/memnodes.h
Executable file
@@ -0,0 +1,78 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* memnodes.h
|
||||
* POSTGRES memory context node definitions.
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/nodes/memnodes.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef MEMNODES_H
|
||||
#define MEMNODES_H
|
||||
|
||||
#include "nodes/nodes.h"
|
||||
|
||||
/*
|
||||
* MemoryContext
|
||||
* A logical context in which memory allocations occur.
|
||||
*
|
||||
* MemoryContext itself is an abstract type that can have multiple
|
||||
* implementations, though for now we have only AllocSetContext.
|
||||
* The function pointers in MemoryContextMethods define one specific
|
||||
* implementation of MemoryContext --- they are a virtual function table
|
||||
* in C++ terms.
|
||||
*
|
||||
* Node types that are actual implementations of memory contexts must
|
||||
* begin with the same fields as MemoryContext.
|
||||
*
|
||||
* Note: for largely historical reasons, typedef MemoryContext is a pointer
|
||||
* to the context struct rather than the struct type itself.
|
||||
*/
|
||||
|
||||
typedef struct MemoryContextMethods
|
||||
{
|
||||
void *(*alloc) (MemoryContext context, Size size);
|
||||
/* call this free_p in case someone #define's free() */
|
||||
void (*free_p) (MemoryContext context, void *pointer);
|
||||
void *(*realloc) (MemoryContext context, void *pointer, Size size);
|
||||
void (*init) (MemoryContext context);
|
||||
void (*reset) (MemoryContext context);
|
||||
void (*delete_context) (MemoryContext context);
|
||||
Size (*get_chunk_space) (MemoryContext context, void *pointer);
|
||||
bool (*is_empty) (MemoryContext context);
|
||||
void (*stats) (MemoryContext context, int level);
|
||||
#ifdef MEMORY_CONTEXT_CHECKING
|
||||
void (*check) (MemoryContext context);
|
||||
#endif
|
||||
} MemoryContextMethods;
|
||||
|
||||
|
||||
typedef struct MemoryContextData
|
||||
{
|
||||
NodeTag type; /* identifies exact kind of context */
|
||||
MemoryContextMethods *methods; /* virtual function table */
|
||||
MemoryContext parent; /* NULL if no parent (toplevel context) */
|
||||
MemoryContext firstchild; /* head of linked list of children */
|
||||
MemoryContext nextchild; /* next child of same parent */
|
||||
char *name; /* context name (just for debugging) */
|
||||
bool isReset; /* T = no space alloced since last reset */
|
||||
} MemoryContextData;
|
||||
|
||||
/* utils/palloc.h contains typedef struct MemoryContextData *MemoryContext */
|
||||
|
||||
|
||||
/*
|
||||
* MemoryContextIsValid
|
||||
* True iff memory context is valid.
|
||||
*
|
||||
* Add new context types to the set accepted by this macro.
|
||||
*/
|
||||
#define MemoryContextIsValid(context) \
|
||||
((context) != NULL && \
|
||||
(IsA((context), AllocSetContext)))
|
||||
|
||||
#endif /* MEMNODES_H */
|
||||
65
pg_include/nodes/nodeFuncs.h
Executable file
65
pg_include/nodes/nodeFuncs.h
Executable file
@@ -0,0 +1,65 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* nodeFuncs.h
|
||||
* Various general-purpose manipulations of Node trees
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/nodes/nodeFuncs.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef NODEFUNCS_H
|
||||
#define NODEFUNCS_H
|
||||
|
||||
#include "nodes/parsenodes.h"
|
||||
|
||||
|
||||
/* flags bits for query_tree_walker and query_tree_mutator */
|
||||
#define QTW_IGNORE_RT_SUBQUERIES 0x01 /* subqueries in rtable */
|
||||
#define QTW_IGNORE_CTE_SUBQUERIES 0x02 /* subqueries in cteList */
|
||||
#define QTW_IGNORE_RC_SUBQUERIES 0x03 /* both of above */
|
||||
#define QTW_IGNORE_JOINALIASES 0x04 /* JOIN alias var lists */
|
||||
#define QTW_IGNORE_RANGE_TABLE 0x08 /* skip rangetable entirely */
|
||||
#define QTW_EXAMINE_RTES 0x10 /* examine RTEs */
|
||||
#define QTW_DONT_COPY_QUERY 0x20 /* do not copy top Query */
|
||||
|
||||
|
||||
extern Oid exprType(const Node *expr);
|
||||
extern int32 exprTypmod(const Node *expr);
|
||||
extern bool exprIsLengthCoercion(const Node *expr, int32 *coercedTypmod);
|
||||
extern Node *relabel_to_typmod(Node *expr, int32 typmod);
|
||||
extern bool expression_returns_set(Node *clause);
|
||||
|
||||
extern Oid exprCollation(const Node *expr);
|
||||
extern Oid exprInputCollation(const Node *expr);
|
||||
extern void exprSetCollation(Node *expr, Oid collation);
|
||||
extern void exprSetInputCollation(Node *expr, Oid inputcollation);
|
||||
|
||||
extern int exprLocation(const Node *expr);
|
||||
|
||||
extern bool expression_tree_walker(Node *node, bool (*walker) (),
|
||||
void *context);
|
||||
extern Node *expression_tree_mutator(Node *node, Node *(*mutator) (),
|
||||
void *context);
|
||||
|
||||
extern bool query_tree_walker(Query *query, bool (*walker) (),
|
||||
void *context, int flags);
|
||||
extern Query *query_tree_mutator(Query *query, Node *(*mutator) (),
|
||||
void *context, int flags);
|
||||
|
||||
extern bool range_table_walker(List *rtable, bool (*walker) (),
|
||||
void *context, int flags);
|
||||
extern List *range_table_mutator(List *rtable, Node *(*mutator) (),
|
||||
void *context, int flags);
|
||||
|
||||
extern bool query_or_expression_tree_walker(Node *node, bool (*walker) (),
|
||||
void *context, int flags);
|
||||
extern Node *query_or_expression_tree_mutator(Node *node, Node *(*mutator) (),
|
||||
void *context, int flags);
|
||||
|
||||
extern bool raw_expression_tree_walker(Node *node, bool (*walker) (),
|
||||
void *context);
|
||||
|
||||
#endif /* NODEFUNCS_H */
|
||||
607
pg_include/nodes/nodes.h
Executable file
607
pg_include/nodes/nodes.h
Executable file
@@ -0,0 +1,607 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* nodes.h
|
||||
* Definitions for tagged nodes.
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/nodes/nodes.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef NODES_H
|
||||
#define NODES_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 numbers of the node tags are not contiguous. We left holes
|
||||
* here so that we can add more tags without changing the existing enum's.
|
||||
* (Since node tag numbers never exist outside backend memory, there's no
|
||||
* real harm in renumbering, it just costs a full rebuild ...)
|
||||
*/
|
||||
typedef enum NodeTag
|
||||
{
|
||||
T_Invalid = 0,
|
||||
|
||||
/*
|
||||
* TAGS FOR EXECUTOR NODES (execnodes.h)
|
||||
*/
|
||||
T_IndexInfo = 10,
|
||||
T_ExprContext,
|
||||
T_ProjectionInfo,
|
||||
T_JunkFilter,
|
||||
T_ResultRelInfo,
|
||||
T_EState,
|
||||
T_TupleTableSlot,
|
||||
|
||||
/*
|
||||
* TAGS FOR PLAN NODES (plannodes.h)
|
||||
*/
|
||||
T_Plan = 100,
|
||||
T_Result,
|
||||
T_ModifyTable,
|
||||
T_Append,
|
||||
T_MergeAppend,
|
||||
T_RecursiveUnion,
|
||||
T_BitmapAnd,
|
||||
T_BitmapOr,
|
||||
T_Scan,
|
||||
T_SeqScan,
|
||||
T_IndexScan,
|
||||
T_IndexOnlyScan,
|
||||
T_BitmapIndexScan,
|
||||
T_BitmapHeapScan,
|
||||
T_TidScan,
|
||||
T_SubqueryScan,
|
||||
T_FunctionScan,
|
||||
T_ValuesScan,
|
||||
T_CteScan,
|
||||
T_WorkTableScan,
|
||||
T_ForeignScan,
|
||||
T_Join,
|
||||
T_NestLoop,
|
||||
T_MergeJoin,
|
||||
T_HashJoin,
|
||||
T_Material,
|
||||
T_Sort,
|
||||
T_Group,
|
||||
T_Agg,
|
||||
T_WindowAgg,
|
||||
T_Unique,
|
||||
T_Hash,
|
||||
T_SetOp,
|
||||
T_LockRows,
|
||||
T_Limit,
|
||||
/* these aren't subclasses of Plan: */
|
||||
T_NestLoopParam,
|
||||
T_PlanRowMark,
|
||||
T_PlanInvalItem,
|
||||
|
||||
/*
|
||||
* TAGS FOR PLAN STATE NODES (execnodes.h)
|
||||
*
|
||||
* These should correspond one-to-one with Plan node types.
|
||||
*/
|
||||
T_PlanState = 200,
|
||||
T_ResultState,
|
||||
T_ModifyTableState,
|
||||
T_AppendState,
|
||||
T_MergeAppendState,
|
||||
T_RecursiveUnionState,
|
||||
T_BitmapAndState,
|
||||
T_BitmapOrState,
|
||||
T_ScanState,
|
||||
T_SeqScanState,
|
||||
T_IndexScanState,
|
||||
T_IndexOnlyScanState,
|
||||
T_BitmapIndexScanState,
|
||||
T_BitmapHeapScanState,
|
||||
T_TidScanState,
|
||||
T_SubqueryScanState,
|
||||
T_FunctionScanState,
|
||||
T_ValuesScanState,
|
||||
T_CteScanState,
|
||||
T_WorkTableScanState,
|
||||
T_ForeignScanState,
|
||||
T_JoinState,
|
||||
T_NestLoopState,
|
||||
T_MergeJoinState,
|
||||
T_HashJoinState,
|
||||
T_MaterialState,
|
||||
T_SortState,
|
||||
T_GroupState,
|
||||
T_AggState,
|
||||
T_WindowAggState,
|
||||
T_UniqueState,
|
||||
T_HashState,
|
||||
T_SetOpState,
|
||||
T_LockRowsState,
|
||||
T_LimitState,
|
||||
|
||||
/*
|
||||
* TAGS FOR PRIMITIVE NODES (primnodes.h)
|
||||
*/
|
||||
T_Alias = 300,
|
||||
T_RangeVar,
|
||||
T_Expr,
|
||||
T_Var,
|
||||
T_Const,
|
||||
T_Param,
|
||||
T_Aggref,
|
||||
T_WindowFunc,
|
||||
T_ArrayRef,
|
||||
T_FuncExpr,
|
||||
T_NamedArgExpr,
|
||||
T_OpExpr,
|
||||
T_DistinctExpr,
|
||||
T_NullIfExpr,
|
||||
T_ScalarArrayOpExpr,
|
||||
T_BoolExpr,
|
||||
T_SubLink,
|
||||
T_SubPlan,
|
||||
T_AlternativeSubPlan,
|
||||
T_FieldSelect,
|
||||
T_FieldStore,
|
||||
T_RelabelType,
|
||||
T_CoerceViaIO,
|
||||
T_ArrayCoerceExpr,
|
||||
T_ConvertRowtypeExpr,
|
||||
T_CollateExpr,
|
||||
T_CaseExpr,
|
||||
T_CaseWhen,
|
||||
T_CaseTestExpr,
|
||||
T_ArrayExpr,
|
||||
T_RowExpr,
|
||||
T_RowCompareExpr,
|
||||
T_CoalesceExpr,
|
||||
T_MinMaxExpr,
|
||||
T_XmlExpr,
|
||||
T_NullTest,
|
||||
T_BooleanTest,
|
||||
T_CoerceToDomain,
|
||||
T_CoerceToDomainValue,
|
||||
T_SetToDefault,
|
||||
T_CurrentOfExpr,
|
||||
T_TargetEntry,
|
||||
T_RangeTblRef,
|
||||
T_JoinExpr,
|
||||
T_FromExpr,
|
||||
T_IntoClause,
|
||||
|
||||
/*
|
||||
* TAGS FOR EXPRESSION STATE NODES (execnodes.h)
|
||||
*
|
||||
* These correspond (not always one-for-one) to primitive nodes derived
|
||||
* from Expr.
|
||||
*/
|
||||
T_ExprState = 400,
|
||||
T_GenericExprState,
|
||||
T_AggrefExprState,
|
||||
T_WindowFuncExprState,
|
||||
T_ArrayRefExprState,
|
||||
T_FuncExprState,
|
||||
T_ScalarArrayOpExprState,
|
||||
T_BoolExprState,
|
||||
T_SubPlanState,
|
||||
T_AlternativeSubPlanState,
|
||||
T_FieldSelectState,
|
||||
T_FieldStoreState,
|
||||
T_CoerceViaIOState,
|
||||
T_ArrayCoerceExprState,
|
||||
T_ConvertRowtypeExprState,
|
||||
T_CaseExprState,
|
||||
T_CaseWhenState,
|
||||
T_ArrayExprState,
|
||||
T_RowExprState,
|
||||
T_RowCompareExprState,
|
||||
T_CoalesceExprState,
|
||||
T_MinMaxExprState,
|
||||
T_XmlExprState,
|
||||
T_NullTestState,
|
||||
T_CoerceToDomainState,
|
||||
T_DomainConstraintState,
|
||||
T_WholeRowVarExprState, /* will be in a more natural position in 9.3 */
|
||||
|
||||
/*
|
||||
* TAGS FOR PLANNER NODES (relation.h)
|
||||
*/
|
||||
T_PlannerInfo = 500,
|
||||
T_PlannerGlobal,
|
||||
T_RelOptInfo,
|
||||
T_IndexOptInfo,
|
||||
T_ParamPathInfo,
|
||||
T_Path,
|
||||
T_IndexPath,
|
||||
T_BitmapHeapPath,
|
||||
T_BitmapAndPath,
|
||||
T_BitmapOrPath,
|
||||
T_NestPath,
|
||||
T_MergePath,
|
||||
T_HashPath,
|
||||
T_TidPath,
|
||||
T_ForeignPath,
|
||||
T_AppendPath,
|
||||
T_MergeAppendPath,
|
||||
T_ResultPath,
|
||||
T_MaterialPath,
|
||||
T_UniquePath,
|
||||
T_EquivalenceClass,
|
||||
T_EquivalenceMember,
|
||||
T_PathKey,
|
||||
T_RestrictInfo,
|
||||
T_PlaceHolderVar,
|
||||
T_SpecialJoinInfo,
|
||||
T_AppendRelInfo,
|
||||
T_PlaceHolderInfo,
|
||||
T_MinMaxAggInfo,
|
||||
T_PlannerParamItem,
|
||||
|
||||
/*
|
||||
* TAGS FOR MEMORY NODES (memnodes.h)
|
||||
*/
|
||||
T_MemoryContext = 600,
|
||||
T_AllocSetContext,
|
||||
|
||||
/*
|
||||
* TAGS FOR VALUE NODES (value.h)
|
||||
*/
|
||||
T_Value = 650,
|
||||
T_Integer,
|
||||
T_Float,
|
||||
T_String,
|
||||
T_BitString,
|
||||
T_Null,
|
||||
|
||||
/*
|
||||
* TAGS FOR LIST NODES (pg_list.h)
|
||||
*/
|
||||
T_List,
|
||||
T_IntList,
|
||||
T_OidList,
|
||||
|
||||
/*
|
||||
* TAGS FOR STATEMENT NODES (mostly in parsenodes.h)
|
||||
*/
|
||||
T_Query = 700,
|
||||
T_PlannedStmt,
|
||||
T_InsertStmt,
|
||||
T_DeleteStmt,
|
||||
T_UpdateStmt,
|
||||
T_SelectStmt,
|
||||
T_AlterTableStmt,
|
||||
T_AlterTableCmd,
|
||||
T_AlterDomainStmt,
|
||||
T_SetOperationStmt,
|
||||
T_GrantStmt,
|
||||
T_GrantRoleStmt,
|
||||
T_AlterDefaultPrivilegesStmt,
|
||||
T_ClosePortalStmt,
|
||||
T_ClusterStmt,
|
||||
T_CopyStmt,
|
||||
T_CreateStmt,
|
||||
T_DefineStmt,
|
||||
T_DropStmt,
|
||||
T_TruncateStmt,
|
||||
T_CommentStmt,
|
||||
T_FetchStmt,
|
||||
T_IndexStmt,
|
||||
T_CreateFunctionStmt,
|
||||
T_AlterFunctionStmt,
|
||||
T_DoStmt,
|
||||
T_RenameStmt,
|
||||
T_RuleStmt,
|
||||
T_NotifyStmt,
|
||||
T_ListenStmt,
|
||||
T_UnlistenStmt,
|
||||
T_TransactionStmt,
|
||||
T_ViewStmt,
|
||||
T_LoadStmt,
|
||||
T_CreateDomainStmt,
|
||||
T_CreatedbStmt,
|
||||
T_DropdbStmt,
|
||||
T_VacuumStmt,
|
||||
T_ExplainStmt,
|
||||
T_CreateTableAsStmt,
|
||||
T_CreateSeqStmt,
|
||||
T_AlterSeqStmt,
|
||||
T_VariableSetStmt,
|
||||
T_VariableShowStmt,
|
||||
T_DiscardStmt,
|
||||
T_CreateTrigStmt,
|
||||
T_CreatePLangStmt,
|
||||
T_CreateRoleStmt,
|
||||
T_AlterRoleStmt,
|
||||
T_DropRoleStmt,
|
||||
T_LockStmt,
|
||||
T_ConstraintsSetStmt,
|
||||
T_ReindexStmt,
|
||||
T_CheckPointStmt,
|
||||
T_CreateSchemaStmt,
|
||||
T_AlterDatabaseStmt,
|
||||
T_AlterDatabaseSetStmt,
|
||||
T_AlterRoleSetStmt,
|
||||
T_CreateConversionStmt,
|
||||
T_CreateCastStmt,
|
||||
T_CreateOpClassStmt,
|
||||
T_CreateOpFamilyStmt,
|
||||
T_AlterOpFamilyStmt,
|
||||
T_PrepareStmt,
|
||||
T_ExecuteStmt,
|
||||
T_DeallocateStmt,
|
||||
T_DeclareCursorStmt,
|
||||
T_CreateTableSpaceStmt,
|
||||
T_DropTableSpaceStmt,
|
||||
T_AlterObjectSchemaStmt,
|
||||
T_AlterOwnerStmt,
|
||||
T_DropOwnedStmt,
|
||||
T_ReassignOwnedStmt,
|
||||
T_CompositeTypeStmt,
|
||||
T_CreateEnumStmt,
|
||||
T_CreateRangeStmt,
|
||||
T_AlterEnumStmt,
|
||||
T_AlterTSDictionaryStmt,
|
||||
T_AlterTSConfigurationStmt,
|
||||
T_CreateFdwStmt,
|
||||
T_AlterFdwStmt,
|
||||
T_CreateForeignServerStmt,
|
||||
T_AlterForeignServerStmt,
|
||||
T_CreateUserMappingStmt,
|
||||
T_AlterUserMappingStmt,
|
||||
T_DropUserMappingStmt,
|
||||
T_AlterTableSpaceOptionsStmt,
|
||||
T_SecLabelStmt,
|
||||
T_CreateForeignTableStmt,
|
||||
T_CreateExtensionStmt,
|
||||
T_AlterExtensionStmt,
|
||||
T_AlterExtensionContentsStmt,
|
||||
|
||||
/*
|
||||
* TAGS FOR PARSE TREE NODES (parsenodes.h)
|
||||
*/
|
||||
T_A_Expr = 900,
|
||||
T_ColumnRef,
|
||||
T_ParamRef,
|
||||
T_A_Const,
|
||||
T_FuncCall,
|
||||
T_A_Star,
|
||||
T_A_Indices,
|
||||
T_A_Indirection,
|
||||
T_A_ArrayExpr,
|
||||
T_ResTarget,
|
||||
T_TypeCast,
|
||||
T_CollateClause,
|
||||
T_SortBy,
|
||||
T_WindowDef,
|
||||
T_RangeSubselect,
|
||||
T_RangeFunction,
|
||||
T_TypeName,
|
||||
T_ColumnDef,
|
||||
T_IndexElem,
|
||||
T_Constraint,
|
||||
T_DefElem,
|
||||
T_RangeTblEntry,
|
||||
T_SortGroupClause,
|
||||
T_WindowClause,
|
||||
T_PrivGrantee,
|
||||
T_FuncWithArgs,
|
||||
T_AccessPriv,
|
||||
T_CreateOpClassItem,
|
||||
T_TableLikeClause,
|
||||
T_FunctionParameter,
|
||||
T_LockingClause,
|
||||
T_RowMarkClause,
|
||||
T_XmlSerialize,
|
||||
T_WithClause,
|
||||
T_CommonTableExpr,
|
||||
|
||||
/*
|
||||
* TAGS FOR REPLICATION GRAMMAR PARSE NODES (replnodes.h)
|
||||
*/
|
||||
T_IdentifySystemCmd,
|
||||
T_BaseBackupCmd,
|
||||
T_StartReplicationCmd,
|
||||
|
||||
/*
|
||||
* TAGS FOR RANDOM OTHER STUFF
|
||||
*
|
||||
* These are objects that aren't part of parse/plan/execute node tree
|
||||
* structures, but we give them NodeTags anyway for identification
|
||||
* purposes (usually because they are involved in APIs where we want to
|
||||
* pass multiple object types through the same pointer).
|
||||
*/
|
||||
T_TriggerData = 950, /* in commands/trigger.h */
|
||||
T_ReturnSetInfo, /* in nodes/execnodes.h */
|
||||
T_WindowObjectData, /* private in nodeWindowAgg.c */
|
||||
T_TIDBitmap, /* in nodes/tidbitmap.h */
|
||||
T_InlineCodeBlock, /* in nodes/parsenodes.h */
|
||||
T_FdwRoutine /* in foreign/fdwapi.h */
|
||||
} NodeTag;
|
||||
|
||||
/*
|
||||
* The first field of a node of any type is guaranteed 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(nodeptr) (((const Node*)(nodeptr))->type)
|
||||
|
||||
/*
|
||||
* newNode -
|
||||
* create a new node of the specified size and tag the node with the
|
||||
* specified tag.
|
||||
*
|
||||
* !WARNING!: Avoid using newNode directly. You should be using the
|
||||
* macro makeNode. eg. to create a Query node, use makeNode(Query)
|
||||
*
|
||||
* Note: the size argument should always be a compile-time constant, so the
|
||||
* apparent risk of multiple evaluation doesn't matter in practice.
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
|
||||
/* With GCC, we can use a compound statement within an expression */
|
||||
#define newNode(size, tag) \
|
||||
({ Node *_result; \
|
||||
AssertMacro((size) >= sizeof(Node)); /* need the tag, at least */ \
|
||||
_result = (Node *) palloc0fast(size); \
|
||||
_result->type = (tag); \
|
||||
_result; \
|
||||
})
|
||||
#else
|
||||
|
||||
/*
|
||||
* There is no way to dereference the palloc'ed pointer to assign the
|
||||
* tag, and also return the pointer itself, so we need a holder variable.
|
||||
* Fortunately, this macro isn't recursive so we just define
|
||||
* a global variable for this purpose.
|
||||
*/
|
||||
extern PGDLLIMPORT Node *newNodeMacroHolder;
|
||||
|
||||
#define newNode(size, tag) \
|
||||
( \
|
||||
AssertMacro((size) >= sizeof(Node)), /* need the tag, at least */ \
|
||||
newNodeMacroHolder = (Node *) palloc0fast(size), \
|
||||
newNodeMacroHolder->type = (tag), \
|
||||
newNodeMacroHolder \
|
||||
)
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
|
||||
#define makeNode(_type_) ((_type_ *) newNode(sizeof(_type_),T_##_type_))
|
||||
#define NodeSetTag(nodeptr,t) (((Node*)(nodeptr))->type = (t))
|
||||
|
||||
#define IsA(nodeptr,_type_) (nodeTag(nodeptr) == T_##_type_)
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
* extern declarations follow
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* nodes/{outfuncs.c,print.c}
|
||||
*/
|
||||
extern char *nodeToString(const void *obj);
|
||||
|
||||
/*
|
||||
* nodes/{readfuncs.c,read.c}
|
||||
*/
|
||||
extern void *stringToNode(char *str);
|
||||
|
||||
/*
|
||||
* nodes/copyfuncs.c
|
||||
*/
|
||||
extern void *copyObject(const void *obj);
|
||||
|
||||
/*
|
||||
* nodes/equalfuncs.c
|
||||
*/
|
||||
extern bool equal(const void *a, const void *b);
|
||||
|
||||
|
||||
/*
|
||||
* Typedefs for identifying qualifier selectivities and plan costs as such.
|
||||
* These are just plain "double"s, but declaring a variable as Selectivity
|
||||
* or Cost makes the intent more obvious.
|
||||
*
|
||||
* These could have gone into plannodes.h or some such, but many files
|
||||
* depend on them...
|
||||
*/
|
||||
typedef double Selectivity; /* fraction of tuples a qualifier will pass */
|
||||
typedef double Cost; /* execution cost (in page-access units) */
|
||||
|
||||
|
||||
/*
|
||||
* CmdType -
|
||||
* enums for type of operation represented by a Query or PlannedStmt
|
||||
*
|
||||
* This is needed in both parsenodes.h and plannodes.h, so put it here...
|
||||
*/
|
||||
typedef enum CmdType
|
||||
{
|
||||
CMD_UNKNOWN,
|
||||
CMD_SELECT, /* select stmt */
|
||||
CMD_UPDATE, /* update stmt */
|
||||
CMD_INSERT, /* insert stmt */
|
||||
CMD_DELETE,
|
||||
CMD_UTILITY, /* cmds like create, destroy, copy, vacuum,
|
||||
* etc. */
|
||||
CMD_NOTHING /* dummy command for instead nothing rules
|
||||
* with qual */
|
||||
} CmdType;
|
||||
|
||||
|
||||
/*
|
||||
* JoinType -
|
||||
* enums for types of relation joins
|
||||
*
|
||||
* JoinType determines the exact semantics of joining two relations using
|
||||
* a matching qualification. For example, it tells what to do with a tuple
|
||||
* that has no match in the other relation.
|
||||
*
|
||||
* This is needed in both parsenodes.h and plannodes.h, so put it here...
|
||||
*/
|
||||
typedef enum JoinType
|
||||
{
|
||||
/*
|
||||
* The canonical kinds of joins according to the SQL JOIN syntax. Only
|
||||
* these codes can appear in parser output (e.g., JoinExpr nodes).
|
||||
*/
|
||||
JOIN_INNER, /* matching tuple pairs only */
|
||||
JOIN_LEFT, /* pairs + unmatched LHS tuples */
|
||||
JOIN_FULL, /* pairs + unmatched LHS + unmatched RHS */
|
||||
JOIN_RIGHT, /* pairs + unmatched RHS tuples */
|
||||
|
||||
/*
|
||||
* Semijoins and anti-semijoins (as defined in relational theory) do not
|
||||
* appear in the SQL JOIN syntax, but there are standard idioms for
|
||||
* representing them (e.g., using EXISTS). The planner recognizes these
|
||||
* cases and converts them to joins. So the planner and executor must
|
||||
* support these codes. NOTE: in JOIN_SEMI output, it is unspecified
|
||||
* which matching RHS row is joined to. In JOIN_ANTI output, the row is
|
||||
* guaranteed to be null-extended.
|
||||
*/
|
||||
JOIN_SEMI, /* 1 copy of each LHS row that has match(es) */
|
||||
JOIN_ANTI, /* 1 copy of each LHS row that has no match */
|
||||
|
||||
/*
|
||||
* These codes are used internally in the planner, but are not supported
|
||||
* by the executor (nor, indeed, by most of the planner).
|
||||
*/
|
||||
JOIN_UNIQUE_OUTER, /* LHS path must be made unique */
|
||||
JOIN_UNIQUE_INNER /* RHS path must be made unique */
|
||||
|
||||
/*
|
||||
* We might need additional join types someday.
|
||||
*/
|
||||
} JoinType;
|
||||
|
||||
/*
|
||||
* OUTER joins are those for which pushed-down quals must behave differently
|
||||
* from the join's own quals. This is in fact everything except INNER and
|
||||
* SEMI joins. However, this macro must also exclude the JOIN_UNIQUE symbols
|
||||
* since those are temporary proxies for what will eventually be an INNER
|
||||
* join.
|
||||
*
|
||||
* Note: semijoins are a hybrid case, but we choose to treat them as not
|
||||
* being outer joins. This is okay principally because the SQL syntax makes
|
||||
* it impossible to have a pushed-down qual that refers to the inner relation
|
||||
* of a semijoin; so there is no strong need to distinguish join quals from
|
||||
* pushed-down quals. This is convenient because for almost all purposes,
|
||||
* quals attached to a semijoin can be treated the same as innerjoin quals.
|
||||
*/
|
||||
#define IS_OUTER_JOIN(jointype) \
|
||||
(((1 << (jointype)) & \
|
||||
((1 << JOIN_LEFT) | \
|
||||
(1 << JOIN_FULL) | \
|
||||
(1 << JOIN_RIGHT) | \
|
||||
(1 << JOIN_ANTI))) != 0)
|
||||
|
||||
#endif /* NODES_H */
|
||||
106
pg_include/nodes/params.h
Executable file
106
pg_include/nodes/params.h
Executable file
@@ -0,0 +1,106 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* params.h
|
||||
* Support for finding the values associated with Param nodes.
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/nodes/params.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef PARAMS_H
|
||||
#define PARAMS_H
|
||||
|
||||
/* To avoid including a pile of parser headers, reference ParseState thus: */
|
||||
struct ParseState;
|
||||
|
||||
|
||||
/* ----------------
|
||||
* ParamListInfo
|
||||
*
|
||||
* ParamListInfo arrays are used to pass parameters into the executor
|
||||
* for parameterized plans. Each entry in the array defines the value
|
||||
* to be substituted for a PARAM_EXTERN parameter. The "paramid"
|
||||
* of a PARAM_EXTERN Param can range from 1 to numParams.
|
||||
*
|
||||
* Although parameter numbers are normally consecutive, we allow
|
||||
* ptype == InvalidOid to signal an unused array entry.
|
||||
*
|
||||
* pflags is a flags field. Currently the only used bit is:
|
||||
* PARAM_FLAG_CONST signals the planner that it may treat this parameter
|
||||
* as a constant (i.e., generate a plan that works only for this value
|
||||
* of the parameter).
|
||||
*
|
||||
* There are two hook functions that can be associated with a ParamListInfo
|
||||
* array to support dynamic parameter handling. First, if paramFetch
|
||||
* isn't null and the executor requires a value for an invalid parameter
|
||||
* (one with ptype == InvalidOid), the paramFetch hook is called to give
|
||||
* it a chance to fill in the parameter value. Second, a parserSetup
|
||||
* hook can be supplied to re-instantiate the original parsing hooks if
|
||||
* a query needs to be re-parsed/planned (as a substitute for supposing
|
||||
* that the current ptype values represent a fixed set of parameter types).
|
||||
|
||||
* Although the data structure is really an array, not a list, we keep
|
||||
* the old typedef name to avoid unnecessary code changes.
|
||||
* ----------------
|
||||
*/
|
||||
|
||||
#define PARAM_FLAG_CONST 0x0001 /* parameter is constant */
|
||||
|
||||
typedef struct ParamExternData
|
||||
{
|
||||
Datum value; /* parameter value */
|
||||
bool isnull; /* is it NULL? */
|
||||
uint16 pflags; /* flag bits, see above */
|
||||
Oid ptype; /* parameter's datatype, or 0 */
|
||||
} ParamExternData;
|
||||
|
||||
typedef struct ParamListInfoData *ParamListInfo;
|
||||
|
||||
typedef void (*ParamFetchHook) (ParamListInfo params, int paramid);
|
||||
|
||||
typedef void (*ParserSetupHook) (struct ParseState *pstate, void *arg);
|
||||
|
||||
typedef struct ParamListInfoData
|
||||
{
|
||||
ParamFetchHook paramFetch; /* parameter fetch hook */
|
||||
void *paramFetchArg;
|
||||
ParserSetupHook parserSetup; /* parser setup hook */
|
||||
void *parserSetupArg;
|
||||
int numParams; /* number of ParamExternDatas following */
|
||||
ParamExternData params[1]; /* VARIABLE LENGTH ARRAY */
|
||||
} ParamListInfoData;
|
||||
|
||||
|
||||
/* ----------------
|
||||
* ParamExecData
|
||||
*
|
||||
* ParamExecData entries are used for executor internal parameters
|
||||
* (that is, values being passed into or out of a sub-query). The
|
||||
* paramid of a PARAM_EXEC Param is a (zero-based) index into an
|
||||
* array of ParamExecData records, which is referenced through
|
||||
* es_param_exec_vals or ecxt_param_exec_vals.
|
||||
*
|
||||
* If execPlan is not NULL, it points to a SubPlanState node that needs
|
||||
* to be executed to produce the value. (This is done so that we can have
|
||||
* lazy evaluation of InitPlans: they aren't executed until/unless a
|
||||
* result value is needed.) Otherwise the value is assumed to be valid
|
||||
* when needed.
|
||||
* ----------------
|
||||
*/
|
||||
|
||||
typedef struct ParamExecData
|
||||
{
|
||||
void *execPlan; /* should be "SubPlanState *" */
|
||||
Datum value;
|
||||
bool isnull;
|
||||
} ParamExecData;
|
||||
|
||||
|
||||
/* Functions found in src/backend/nodes/params.c */
|
||||
extern ParamListInfo copyParamList(ParamListInfo from);
|
||||
|
||||
#endif /* PARAMS_H */
|
||||
2610
pg_include/nodes/parsenodes.h
Executable file
2610
pg_include/nodes/parsenodes.h
Executable file
File diff suppressed because it is too large
Load Diff
324
pg_include/nodes/pg_list.h
Executable file
324
pg_include/nodes/pg_list.h
Executable file
@@ -0,0 +1,324 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* pg_list.h
|
||||
* interface for PostgreSQL generic linked list package
|
||||
*
|
||||
* This package implements singly-linked homogeneous lists.
|
||||
*
|
||||
* It is important to have constant-time length, append, and prepend
|
||||
* operations. To achieve this, we deal with two distinct data
|
||||
* structures:
|
||||
*
|
||||
* 1. A set of "list cells": each cell contains a data field and
|
||||
* a link to the next cell in the list or NULL.
|
||||
* 2. A single structure containing metadata about the list: the
|
||||
* type of the list, pointers to the head and tail cells, and
|
||||
* the length of the list.
|
||||
*
|
||||
* We support three types of lists:
|
||||
*
|
||||
* T_List: lists of pointers
|
||||
* (in practice usually pointers to Nodes, but not always;
|
||||
* declared as "void *" to minimize casting annoyances)
|
||||
* T_IntList: lists of integers
|
||||
* T_OidList: lists of Oids
|
||||
*
|
||||
* (At the moment, ints and Oids are the same size, but they may not
|
||||
* always be so; try to be careful to maintain the distinction.)
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/nodes/pg_list.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef PG_LIST_H
|
||||
#define PG_LIST_H
|
||||
|
||||
#include "nodes/nodes.h"
|
||||
|
||||
|
||||
typedef struct ListCell ListCell;
|
||||
|
||||
typedef struct List
|
||||
{
|
||||
NodeTag type; /* T_List, T_IntList, or T_OidList */
|
||||
int length;
|
||||
ListCell *head;
|
||||
ListCell *tail;
|
||||
} List;
|
||||
|
||||
struct ListCell
|
||||
{
|
||||
union
|
||||
{
|
||||
void *ptr_value;
|
||||
int int_value;
|
||||
Oid oid_value;
|
||||
} data;
|
||||
ListCell *next;
|
||||
};
|
||||
|
||||
/*
|
||||
* The *only* valid representation of an empty list is NIL; in other
|
||||
* words, a non-NIL list is guaranteed to have length >= 1 and
|
||||
* head/tail != NULL
|
||||
*/
|
||||
#define NIL ((List *) NULL)
|
||||
|
||||
/*
|
||||
* These routines are used frequently. However, we can't implement
|
||||
* them as macros, since we want to avoid double-evaluation of macro
|
||||
* arguments. Therefore, we implement them using static inline functions
|
||||
* if supported by the compiler, or as regular functions otherwise.
|
||||
*/
|
||||
#ifdef USE_INLINE
|
||||
|
||||
static inline ListCell *
|
||||
list_head(const List *l)
|
||||
{
|
||||
return l ? l->head : NULL;
|
||||
}
|
||||
|
||||
static inline ListCell *
|
||||
list_tail(List *l)
|
||||
{
|
||||
return l ? l->tail : NULL;
|
||||
}
|
||||
|
||||
static inline int
|
||||
list_length(const List *l)
|
||||
{
|
||||
return l ? l->length : 0;
|
||||
}
|
||||
#else
|
||||
|
||||
extern ListCell *list_head(const List *l);
|
||||
extern ListCell *list_tail(List *l);
|
||||
extern int list_length(const List *l);
|
||||
#endif /* USE_INLINE */
|
||||
|
||||
/*
|
||||
* NB: There is an unfortunate legacy from a previous incarnation of
|
||||
* the List API: the macro lfirst() was used to mean "the data in this
|
||||
* cons cell". To avoid changing every usage of lfirst(), that meaning
|
||||
* has been kept. As a result, lfirst() takes a ListCell and returns
|
||||
* the data it contains; to get the data in the first cell of a
|
||||
* List, use linitial(). Worse, lsecond() is more closely related to
|
||||
* linitial() than lfirst(): given a List, lsecond() returns the data
|
||||
* in the second cons cell.
|
||||
*/
|
||||
|
||||
#define lnext(lc) ((lc)->next)
|
||||
#define lfirst(lc) ((lc)->data.ptr_value)
|
||||
#define lfirst_int(lc) ((lc)->data.int_value)
|
||||
#define lfirst_oid(lc) ((lc)->data.oid_value)
|
||||
|
||||
#define linitial(l) lfirst(list_head(l))
|
||||
#define linitial_int(l) lfirst_int(list_head(l))
|
||||
#define linitial_oid(l) lfirst_oid(list_head(l))
|
||||
|
||||
#define lsecond(l) lfirst(lnext(list_head(l)))
|
||||
#define lsecond_int(l) lfirst_int(lnext(list_head(l)))
|
||||
#define lsecond_oid(l) lfirst_oid(lnext(list_head(l)))
|
||||
|
||||
#define lthird(l) lfirst(lnext(lnext(list_head(l))))
|
||||
#define lthird_int(l) lfirst_int(lnext(lnext(list_head(l))))
|
||||
#define lthird_oid(l) lfirst_oid(lnext(lnext(list_head(l))))
|
||||
|
||||
#define lfourth(l) lfirst(lnext(lnext(lnext(list_head(l)))))
|
||||
#define lfourth_int(l) lfirst_int(lnext(lnext(lnext(list_head(l)))))
|
||||
#define lfourth_oid(l) lfirst_oid(lnext(lnext(lnext(list_head(l)))))
|
||||
|
||||
#define llast(l) lfirst(list_tail(l))
|
||||
#define llast_int(l) lfirst_int(list_tail(l))
|
||||
#define llast_oid(l) lfirst_oid(list_tail(l))
|
||||
|
||||
/*
|
||||
* Convenience macros for building fixed-length lists
|
||||
*/
|
||||
#define list_make1(x1) lcons(x1, NIL)
|
||||
#define list_make2(x1,x2) lcons(x1, list_make1(x2))
|
||||
#define list_make3(x1,x2,x3) lcons(x1, list_make2(x2, x3))
|
||||
#define list_make4(x1,x2,x3,x4) lcons(x1, list_make3(x2, x3, x4))
|
||||
|
||||
#define list_make1_int(x1) lcons_int(x1, NIL)
|
||||
#define list_make2_int(x1,x2) lcons_int(x1, list_make1_int(x2))
|
||||
#define list_make3_int(x1,x2,x3) lcons_int(x1, list_make2_int(x2, x3))
|
||||
#define list_make4_int(x1,x2,x3,x4) lcons_int(x1, list_make3_int(x2, x3, x4))
|
||||
|
||||
#define list_make1_oid(x1) lcons_oid(x1, NIL)
|
||||
#define list_make2_oid(x1,x2) lcons_oid(x1, list_make1_oid(x2))
|
||||
#define list_make3_oid(x1,x2,x3) lcons_oid(x1, list_make2_oid(x2, x3))
|
||||
#define list_make4_oid(x1,x2,x3,x4) lcons_oid(x1, list_make3_oid(x2, x3, x4))
|
||||
|
||||
/*
|
||||
* foreach -
|
||||
* a convenience macro which loops through the list
|
||||
*/
|
||||
#define foreach(cell, l) \
|
||||
for ((cell) = list_head(l); (cell) != NULL; (cell) = lnext(cell))
|
||||
|
||||
/*
|
||||
* for_each_cell -
|
||||
* a convenience macro which loops through a list starting from a
|
||||
* specified cell
|
||||
*/
|
||||
#define for_each_cell(cell, initcell) \
|
||||
for ((cell) = (initcell); (cell) != NULL; (cell) = lnext(cell))
|
||||
|
||||
/*
|
||||
* forboth -
|
||||
* a convenience macro for advancing through two linked lists
|
||||
* simultaneously. This macro loops through both lists at the same
|
||||
* time, stopping when either list runs out of elements. Depending
|
||||
* on the requirements of the call site, it may also be wise to
|
||||
* assert that the lengths of the two lists are equal.
|
||||
*/
|
||||
#define forboth(cell1, list1, cell2, list2) \
|
||||
for ((cell1) = list_head(list1), (cell2) = list_head(list2); \
|
||||
(cell1) != NULL && (cell2) != NULL; \
|
||||
(cell1) = lnext(cell1), (cell2) = lnext(cell2))
|
||||
|
||||
/*
|
||||
* forthree -
|
||||
* the same for three lists
|
||||
*/
|
||||
#define forthree(cell1, list1, cell2, list2, cell3, list3) \
|
||||
for ((cell1) = list_head(list1), (cell2) = list_head(list2), (cell3) = list_head(list3); \
|
||||
(cell1) != NULL && (cell2) != NULL && (cell3) != NULL; \
|
||||
(cell1) = lnext(cell1), (cell2) = lnext(cell2), (cell3) = lnext(cell3))
|
||||
|
||||
extern List *lappend(List *list, void *datum);
|
||||
extern List *lappend_int(List *list, int datum);
|
||||
extern List *lappend_oid(List *list, Oid datum);
|
||||
|
||||
extern ListCell *lappend_cell(List *list, ListCell *prev, void *datum);
|
||||
extern ListCell *lappend_cell_int(List *list, ListCell *prev, int datum);
|
||||
extern ListCell *lappend_cell_oid(List *list, ListCell *prev, Oid datum);
|
||||
|
||||
extern List *lcons(void *datum, List *list);
|
||||
extern List *lcons_int(int datum, List *list);
|
||||
extern List *lcons_oid(Oid datum, List *list);
|
||||
|
||||
extern List *list_concat(List *list1, List *list2);
|
||||
extern List *list_truncate(List *list, int new_size);
|
||||
|
||||
extern void *list_nth(const List *list, int n);
|
||||
extern int list_nth_int(const List *list, int n);
|
||||
extern Oid list_nth_oid(const List *list, int n);
|
||||
|
||||
extern bool list_member(const List *list, const void *datum);
|
||||
extern bool list_member_ptr(const List *list, const void *datum);
|
||||
extern bool list_member_int(const List *list, int datum);
|
||||
extern bool list_member_oid(const List *list, Oid datum);
|
||||
|
||||
extern List *list_delete(List *list, void *datum);
|
||||
extern List *list_delete_ptr(List *list, void *datum);
|
||||
extern List *list_delete_int(List *list, int datum);
|
||||
extern List *list_delete_oid(List *list, Oid datum);
|
||||
extern List *list_delete_first(List *list);
|
||||
extern List *list_delete_cell(List *list, ListCell *cell, ListCell *prev);
|
||||
|
||||
extern List *list_union(const List *list1, const List *list2);
|
||||
extern List *list_union_ptr(const List *list1, const List *list2);
|
||||
extern List *list_union_int(const List *list1, const List *list2);
|
||||
extern List *list_union_oid(const List *list1, const List *list2);
|
||||
|
||||
extern List *list_intersection(const List *list1, const List *list2);
|
||||
|
||||
/* currently, there's no need for list_intersection_int etc */
|
||||
|
||||
extern List *list_difference(const List *list1, const List *list2);
|
||||
extern List *list_difference_ptr(const List *list1, const List *list2);
|
||||
extern List *list_difference_int(const List *list1, const List *list2);
|
||||
extern List *list_difference_oid(const List *list1, const List *list2);
|
||||
|
||||
extern List *list_append_unique(List *list, void *datum);
|
||||
extern List *list_append_unique_ptr(List *list, void *datum);
|
||||
extern List *list_append_unique_int(List *list, int datum);
|
||||
extern List *list_append_unique_oid(List *list, Oid datum);
|
||||
|
||||
extern List *list_concat_unique(List *list1, List *list2);
|
||||
extern List *list_concat_unique_ptr(List *list1, List *list2);
|
||||
extern List *list_concat_unique_int(List *list1, List *list2);
|
||||
extern List *list_concat_unique_oid(List *list1, List *list2);
|
||||
|
||||
extern void list_free(List *list);
|
||||
extern void list_free_deep(List *list);
|
||||
|
||||
extern List *list_copy(const List *list);
|
||||
extern List *list_copy_tail(const List *list, int nskip);
|
||||
|
||||
/*
|
||||
* To ease migration to the new list API, a set of compatibility
|
||||
* macros are provided that reduce the impact of the list API changes
|
||||
* as far as possible. Until client code has been rewritten to use the
|
||||
* new list API, the ENABLE_LIST_COMPAT symbol can be defined before
|
||||
* including pg_list.h
|
||||
*/
|
||||
#ifdef ENABLE_LIST_COMPAT
|
||||
|
||||
#define lfirsti(lc) lfirst_int(lc)
|
||||
#define lfirsto(lc) lfirst_oid(lc)
|
||||
|
||||
#define makeList1(x1) list_make1(x1)
|
||||
#define makeList2(x1, x2) list_make2(x1, x2)
|
||||
#define makeList3(x1, x2, x3) list_make3(x1, x2, x3)
|
||||
#define makeList4(x1, x2, x3, x4) list_make4(x1, x2, x3, x4)
|
||||
|
||||
#define makeListi1(x1) list_make1_int(x1)
|
||||
#define makeListi2(x1, x2) list_make2_int(x1, x2)
|
||||
|
||||
#define makeListo1(x1) list_make1_oid(x1)
|
||||
#define makeListo2(x1, x2) list_make2_oid(x1, x2)
|
||||
|
||||
#define lconsi(datum, list) lcons_int(datum, list)
|
||||
#define lconso(datum, list) lcons_oid(datum, list)
|
||||
|
||||
#define lappendi(list, datum) lappend_int(list, datum)
|
||||
#define lappendo(list, datum) lappend_oid(list, datum)
|
||||
|
||||
#define nconc(l1, l2) list_concat(l1, l2)
|
||||
|
||||
#define nth(n, list) list_nth(list, n)
|
||||
|
||||
#define member(datum, list) list_member(list, datum)
|
||||
#define ptrMember(datum, list) list_member_ptr(list, datum)
|
||||
#define intMember(datum, list) list_member_int(list, datum)
|
||||
#define oidMember(datum, list) list_member_oid(list, datum)
|
||||
|
||||
/*
|
||||
* Note that the old lremove() determined equality via pointer
|
||||
* comparison, whereas the new list_delete() uses equal(); in order to
|
||||
* keep the same behavior, we therefore need to map lremove() calls to
|
||||
* list_delete_ptr() rather than list_delete()
|
||||
*/
|
||||
#define lremove(elem, list) list_delete_ptr(list, elem)
|
||||
#define LispRemove(elem, list) list_delete(list, elem)
|
||||
#define lremovei(elem, list) list_delete_int(list, elem)
|
||||
#define lremoveo(elem, list) list_delete_oid(list, elem)
|
||||
|
||||
#define ltruncate(n, list) list_truncate(list, n)
|
||||
|
||||
#define set_union(l1, l2) list_union(l1, l2)
|
||||
#define set_uniono(l1, l2) list_union_oid(l1, l2)
|
||||
#define set_ptrUnion(l1, l2) list_union_ptr(l1, l2)
|
||||
|
||||
#define set_difference(l1, l2) list_difference(l1, l2)
|
||||
#define set_differenceo(l1, l2) list_difference_oid(l1, l2)
|
||||
#define set_ptrDifference(l1, l2) list_difference_ptr(l1, l2)
|
||||
|
||||
#define equali(l1, l2) equal(l1, l2)
|
||||
#define equalo(l1, l2) equal(l1, l2)
|
||||
|
||||
#define freeList(list) list_free(list)
|
||||
|
||||
#define listCopy(list) list_copy(list)
|
||||
|
||||
extern int length(List *list);
|
||||
#endif /* ENABLE_LIST_COMPAT */
|
||||
|
||||
#endif /* PG_LIST_H */
|
||||
835
pg_include/nodes/plannodes.h
Executable file
835
pg_include/nodes/plannodes.h
Executable file
@@ -0,0 +1,835 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* plannodes.h
|
||||
* definitions for query plan nodes
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/nodes/plannodes.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef PLANNODES_H
|
||||
#define PLANNODES_H
|
||||
|
||||
#include "access/sdir.h"
|
||||
#include "nodes/bitmapset.h"
|
||||
#include "nodes/primnodes.h"
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
* node definitions
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ----------------
|
||||
* PlannedStmt node
|
||||
*
|
||||
* The output of the planner is a Plan tree headed by a PlannedStmt node.
|
||||
* PlannedStmt holds the "one time" information needed by the executor.
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct PlannedStmt
|
||||
{
|
||||
NodeTag type;
|
||||
|
||||
CmdType commandType; /* select|insert|update|delete */
|
||||
|
||||
uint32 queryId; /* query identifier (copied from Query) */
|
||||
|
||||
bool hasReturning; /* is it insert|update|delete RETURNING? */
|
||||
|
||||
bool hasModifyingCTE; /* has insert|update|delete in WITH? */
|
||||
|
||||
bool canSetTag; /* do I set the command result tag? */
|
||||
|
||||
bool transientPlan; /* redo plan when TransactionXmin changes? */
|
||||
|
||||
struct Plan *planTree; /* tree of Plan nodes */
|
||||
|
||||
List *rtable; /* list of RangeTblEntry nodes */
|
||||
|
||||
/* rtable indexes of target relations for INSERT/UPDATE/DELETE */
|
||||
List *resultRelations; /* integer list of RT indexes, or NIL */
|
||||
|
||||
Node *utilityStmt; /* non-null if this is DECLARE CURSOR */
|
||||
|
||||
List *subplans; /* Plan trees for SubPlan expressions */
|
||||
|
||||
Bitmapset *rewindPlanIDs; /* indices of subplans that require REWIND */
|
||||
|
||||
List *rowMarks; /* a list of PlanRowMark's */
|
||||
|
||||
List *relationOids; /* OIDs of relations the plan depends on */
|
||||
|
||||
List *invalItems; /* other dependencies, as PlanInvalItems */
|
||||
|
||||
int nParamExec; /* number of PARAM_EXEC Params used */
|
||||
} PlannedStmt;
|
||||
|
||||
/* macro for fetching the Plan associated with a SubPlan node */
|
||||
#define exec_subplan_get_plan(plannedstmt, subplan) \
|
||||
((Plan *) list_nth((plannedstmt)->subplans, (subplan)->plan_id - 1))
|
||||
|
||||
|
||||
/* ----------------
|
||||
* Plan node
|
||||
*
|
||||
* 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)
|
||||
*
|
||||
* We never actually instantiate any Plan nodes; this is just the common
|
||||
* abstract superclass for all Plan-type nodes.
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct Plan
|
||||
{
|
||||
NodeTag type;
|
||||
|
||||
/*
|
||||
* estimated execution costs for plan (see costsize.c for more info)
|
||||
*/
|
||||
Cost startup_cost; /* cost expended before fetching any tuples */
|
||||
Cost total_cost; /* total cost (assuming all tuples fetched) */
|
||||
|
||||
/*
|
||||
* planner's estimate of result size of this plan step
|
||||
*/
|
||||
double plan_rows; /* number of rows plan is expected to emit */
|
||||
int plan_width; /* average row width in bytes */
|
||||
|
||||
/*
|
||||
* Common structural data for all Plan types.
|
||||
*/
|
||||
List *targetlist; /* target list to be computed at this node */
|
||||
List *qual; /* implicitly-ANDed qual conditions */
|
||||
struct Plan *lefttree; /* input plan tree(s) */
|
||||
struct Plan *righttree;
|
||||
List *initPlan; /* Init Plan nodes (un-correlated expr
|
||||
* subselects) */
|
||||
|
||||
/*
|
||||
* Information for management of parameter-change-driven rescanning
|
||||
*
|
||||
* extParam includes the paramIDs of all external PARAM_EXEC params
|
||||
* affecting this plan node or its children. setParam params from the
|
||||
* node's initPlans are not included, but their extParams are.
|
||||
*
|
||||
* allParam includes all the extParam paramIDs, plus the IDs of local
|
||||
* params that affect the node (i.e., the setParams of its initplans).
|
||||
* These are _all_ the PARAM_EXEC params that affect this node.
|
||||
*/
|
||||
Bitmapset *extParam;
|
||||
Bitmapset *allParam;
|
||||
} Plan;
|
||||
|
||||
/* ----------------
|
||||
* these 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)
|
||||
|
||||
|
||||
/* ----------------
|
||||
* Result node -
|
||||
* If no outer plan, evaluate a variable-free targetlist.
|
||||
* If outer plan, return tuples from outer plan (after a level of
|
||||
* projection as shown by targetlist).
|
||||
*
|
||||
* If resconstantqual isn't NULL, it represents a one-time qualification
|
||||
* test (i.e., one that doesn't depend on any variables from the outer plan,
|
||||
* so needs to be evaluated only once).
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct Result
|
||||
{
|
||||
Plan plan;
|
||||
Node *resconstantqual;
|
||||
} Result;
|
||||
|
||||
/* ----------------
|
||||
* ModifyTable node -
|
||||
* Apply rows produced by subplan(s) to result table(s),
|
||||
* by inserting, updating, or deleting.
|
||||
*
|
||||
* Note that rowMarks and epqParam are presumed to be valid for all the
|
||||
* subplan(s); they can't contain any info that varies across subplans.
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct ModifyTable
|
||||
{
|
||||
Plan plan;
|
||||
CmdType operation; /* INSERT, UPDATE, or DELETE */
|
||||
bool canSetTag; /* do we set the command tag/es_processed? */
|
||||
List *resultRelations; /* integer list of RT indexes */
|
||||
int resultRelIndex; /* index of first resultRel in plan's list */
|
||||
List *plans; /* plan(s) producing source data */
|
||||
List *returningLists; /* per-target-table RETURNING tlists */
|
||||
List *rowMarks; /* PlanRowMarks (non-locking only) */
|
||||
int epqParam; /* ID of Param for EvalPlanQual re-eval */
|
||||
} ModifyTable;
|
||||
|
||||
/* ----------------
|
||||
* Append node -
|
||||
* Generate the concatenation of the results of sub-plans.
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct Append
|
||||
{
|
||||
Plan plan;
|
||||
List *appendplans;
|
||||
} Append;
|
||||
|
||||
/* ----------------
|
||||
* MergeAppend node -
|
||||
* Merge the results of pre-sorted sub-plans to preserve the ordering.
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct MergeAppend
|
||||
{
|
||||
Plan plan;
|
||||
List *mergeplans;
|
||||
/* remaining fields are just like the sort-key info in struct Sort */
|
||||
int numCols; /* number of sort-key columns */
|
||||
AttrNumber *sortColIdx; /* their indexes in the target list */
|
||||
Oid *sortOperators; /* OIDs of operators to sort them by */
|
||||
Oid *collations; /* OIDs of collations */
|
||||
bool *nullsFirst; /* NULLS FIRST/LAST directions */
|
||||
} MergeAppend;
|
||||
|
||||
/* ----------------
|
||||
* RecursiveUnion node -
|
||||
* Generate a recursive union of two subplans.
|
||||
*
|
||||
* The "outer" subplan is always the non-recursive term, and the "inner"
|
||||
* subplan is the recursive term.
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct RecursiveUnion
|
||||
{
|
||||
Plan plan;
|
||||
int wtParam; /* ID of Param representing work table */
|
||||
/* Remaining fields are zero/null in UNION ALL case */
|
||||
int numCols; /* number of columns to check for
|
||||
* duplicate-ness */
|
||||
AttrNumber *dupColIdx; /* their indexes in the target list */
|
||||
Oid *dupOperators; /* equality operators to compare with */
|
||||
long numGroups; /* estimated number of groups in input */
|
||||
} RecursiveUnion;
|
||||
|
||||
/* ----------------
|
||||
* BitmapAnd node -
|
||||
* Generate the intersection of the results of sub-plans.
|
||||
*
|
||||
* The subplans must be of types that yield tuple bitmaps. The targetlist
|
||||
* and qual fields of the plan are unused and are always NIL.
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct BitmapAnd
|
||||
{
|
||||
Plan plan;
|
||||
List *bitmapplans;
|
||||
} BitmapAnd;
|
||||
|
||||
/* ----------------
|
||||
* BitmapOr node -
|
||||
* Generate the union of the results of sub-plans.
|
||||
*
|
||||
* The subplans must be of types that yield tuple bitmaps. The targetlist
|
||||
* and qual fields of the plan are unused and are always NIL.
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct BitmapOr
|
||||
{
|
||||
Plan plan;
|
||||
List *bitmapplans;
|
||||
} BitmapOr;
|
||||
|
||||
/*
|
||||
* ==========
|
||||
* Scan nodes
|
||||
* ==========
|
||||
*/
|
||||
typedef struct Scan
|
||||
{
|
||||
Plan plan;
|
||||
Index scanrelid; /* relid is index into the range table */
|
||||
} Scan;
|
||||
|
||||
/* ----------------
|
||||
* sequential scan node
|
||||
* ----------------
|
||||
*/
|
||||
typedef Scan SeqScan;
|
||||
|
||||
/* ----------------
|
||||
* index scan node
|
||||
*
|
||||
* indexqualorig is an implicitly-ANDed list of index qual expressions, each
|
||||
* in the same form it appeared in the query WHERE condition. Each should
|
||||
* be of the form (indexkey OP comparisonval) or (comparisonval OP indexkey).
|
||||
* The indexkey is a Var or expression referencing column(s) of the index's
|
||||
* base table. The comparisonval might be any expression, but it won't use
|
||||
* any columns of the base table. The expressions are ordered by index
|
||||
* column position (but items referencing the same index column can appear
|
||||
* in any order). indexqualorig is used at runtime only if we have to recheck
|
||||
* a lossy indexqual.
|
||||
*
|
||||
* indexqual has the same form, but the expressions have been commuted if
|
||||
* necessary to put the indexkeys on the left, and the indexkeys are replaced
|
||||
* by Var nodes identifying the index columns (their varno is INDEX_VAR and
|
||||
* their varattno is the index column number).
|
||||
*
|
||||
* indexorderbyorig is similarly the original form of any ORDER BY expressions
|
||||
* that are being implemented by the index, while indexorderby is modified to
|
||||
* have index column Vars on the left-hand side. Here, multiple expressions
|
||||
* must appear in exactly the ORDER BY order, and this is not necessarily the
|
||||
* index column order. Only the expressions are provided, not the auxiliary
|
||||
* sort-order information from the ORDER BY SortGroupClauses; it's assumed
|
||||
* that the sort ordering is fully determinable from the top-level operators.
|
||||
* indexorderbyorig is unused at run time, but is needed for EXPLAIN.
|
||||
* (Note these fields are used for amcanorderbyop cases, not amcanorder cases.)
|
||||
*
|
||||
* indexorderdir specifies the scan ordering, for indexscans on amcanorder
|
||||
* indexes (for other indexes it should be "don't care").
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct IndexScan
|
||||
{
|
||||
Scan scan;
|
||||
Oid indexid; /* OID of index to scan */
|
||||
List *indexqual; /* list of index quals (usually OpExprs) */
|
||||
List *indexqualorig; /* the same in original form */
|
||||
List *indexorderby; /* list of index ORDER BY exprs */
|
||||
List *indexorderbyorig; /* the same in original form */
|
||||
ScanDirection indexorderdir; /* forward or backward or don't care */
|
||||
} IndexScan;
|
||||
|
||||
/* ----------------
|
||||
* index-only scan node
|
||||
*
|
||||
* IndexOnlyScan is very similar to IndexScan, but it specifies an
|
||||
* index-only scan, in which the data comes from the index not the heap.
|
||||
* Because of this, *all* Vars in the plan node's targetlist, qual, and
|
||||
* index expressions reference index columns and have varno = INDEX_VAR.
|
||||
* Hence we do not need separate indexqualorig and indexorderbyorig lists,
|
||||
* since their contents would be equivalent to indexqual and indexorderby.
|
||||
*
|
||||
* To help EXPLAIN interpret the index Vars for display, we provide
|
||||
* indextlist, which represents the contents of the index as a targetlist
|
||||
* with one TLE per index column. Vars appearing in this list reference
|
||||
* the base table, and this is the only field in the plan node that may
|
||||
* contain such Vars.
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct IndexOnlyScan
|
||||
{
|
||||
Scan scan;
|
||||
Oid indexid; /* OID of index to scan */
|
||||
List *indexqual; /* list of index quals (usually OpExprs) */
|
||||
List *indexorderby; /* list of index ORDER BY exprs */
|
||||
List *indextlist; /* TargetEntry list describing index's cols */
|
||||
ScanDirection indexorderdir; /* forward or backward or don't care */
|
||||
} IndexOnlyScan;
|
||||
|
||||
/* ----------------
|
||||
* bitmap index scan node
|
||||
*
|
||||
* BitmapIndexScan delivers a bitmap of potential tuple locations;
|
||||
* it does not access the heap itself. The bitmap is used by an
|
||||
* ancestor BitmapHeapScan node, possibly after passing through
|
||||
* intermediate BitmapAnd and/or BitmapOr nodes to combine it with
|
||||
* the results of other BitmapIndexScans.
|
||||
*
|
||||
* The fields have the same meanings as for IndexScan, except we don't
|
||||
* store a direction flag because direction is uninteresting.
|
||||
*
|
||||
* In a BitmapIndexScan plan node, the targetlist and qual fields are
|
||||
* not used and are always NIL. The indexqualorig field is unused at
|
||||
* run time too, but is saved for the benefit of EXPLAIN.
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct BitmapIndexScan
|
||||
{
|
||||
Scan scan;
|
||||
Oid indexid; /* OID of index to scan */
|
||||
List *indexqual; /* list of index quals (OpExprs) */
|
||||
List *indexqualorig; /* the same in original form */
|
||||
} BitmapIndexScan;
|
||||
|
||||
/* ----------------
|
||||
* bitmap sequential scan node
|
||||
*
|
||||
* This needs a copy of the qual conditions being used by the input index
|
||||
* scans because there are various cases where we need to recheck the quals;
|
||||
* for example, when the bitmap is lossy about the specific rows on a page
|
||||
* that meet the index condition.
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct BitmapHeapScan
|
||||
{
|
||||
Scan scan;
|
||||
List *bitmapqualorig; /* index quals, in standard expr form */
|
||||
} BitmapHeapScan;
|
||||
|
||||
/* ----------------
|
||||
* tid scan node
|
||||
*
|
||||
* tidquals is an implicitly OR'ed list of qual expressions of the form
|
||||
* "CTID = pseudoconstant" or "CTID = ANY(pseudoconstant_array)".
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct TidScan
|
||||
{
|
||||
Scan scan;
|
||||
List *tidquals; /* qual(s) involving CTID = something */
|
||||
} TidScan;
|
||||
|
||||
/* ----------------
|
||||
* subquery scan node
|
||||
*
|
||||
* SubqueryScan is for scanning the output of a sub-query in the range table.
|
||||
* We often need an extra plan node above the sub-query's plan to perform
|
||||
* expression evaluations (which we can't push into the sub-query without
|
||||
* risking changing its semantics). Although we are not scanning a physical
|
||||
* relation, we make this a descendant of Scan anyway for code-sharing
|
||||
* purposes.
|
||||
*
|
||||
* Note: we store the sub-plan in the type-specific subplan field, not in
|
||||
* the generic lefttree field as you might expect. This is because we do
|
||||
* not want plan-tree-traversal routines to recurse into the subplan without
|
||||
* knowing that they are changing Query contexts.
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct SubqueryScan
|
||||
{
|
||||
Scan scan;
|
||||
Plan *subplan;
|
||||
} SubqueryScan;
|
||||
|
||||
/* ----------------
|
||||
* FunctionScan node
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct FunctionScan
|
||||
{
|
||||
Scan scan;
|
||||
Node *funcexpr; /* expression tree for func call */
|
||||
List *funccolnames; /* output column names (string Value nodes) */
|
||||
List *funccoltypes; /* OID list of column type OIDs */
|
||||
List *funccoltypmods; /* integer list of column typmods */
|
||||
List *funccolcollations; /* OID list of column collation OIDs */
|
||||
} FunctionScan;
|
||||
|
||||
/* ----------------
|
||||
* ValuesScan node
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct ValuesScan
|
||||
{
|
||||
Scan scan;
|
||||
List *values_lists; /* list of expression lists */
|
||||
} ValuesScan;
|
||||
|
||||
/* ----------------
|
||||
* CteScan node
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct CteScan
|
||||
{
|
||||
Scan scan;
|
||||
int ctePlanId; /* ID of init SubPlan for CTE */
|
||||
int cteParam; /* ID of Param representing CTE output */
|
||||
} CteScan;
|
||||
|
||||
/* ----------------
|
||||
* WorkTableScan node
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct WorkTableScan
|
||||
{
|
||||
Scan scan;
|
||||
int wtParam; /* ID of Param representing work table */
|
||||
} WorkTableScan;
|
||||
|
||||
/* ----------------
|
||||
* ForeignScan node
|
||||
*
|
||||
* fdw_exprs and fdw_private are both under the control of the foreign-data
|
||||
* wrapper, but fdw_exprs is presumed to contain expression trees and will
|
||||
* be post-processed accordingly by the planner; fdw_private won't be.
|
||||
* Note that everything in both lists must be copiable by copyObject().
|
||||
* One way to store an arbitrary blob of bytes is to represent it as a bytea
|
||||
* Const. Usually, though, you'll be better off choosing a representation
|
||||
* that can be dumped usefully by nodeToString().
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct ForeignScan
|
||||
{
|
||||
Scan scan;
|
||||
List *fdw_exprs; /* expressions that FDW may evaluate */
|
||||
List *fdw_private; /* private data for FDW */
|
||||
bool fsSystemCol; /* true if any "system column" is needed */
|
||||
} ForeignScan;
|
||||
|
||||
|
||||
/*
|
||||
* ==========
|
||||
* Join nodes
|
||||
* ==========
|
||||
*/
|
||||
|
||||
/* ----------------
|
||||
* Join node
|
||||
*
|
||||
* jointype: rule for joining tuples from left and right subtrees
|
||||
* joinqual: qual conditions that came from JOIN/ON or JOIN/USING
|
||||
* (plan.qual contains conditions that came from WHERE)
|
||||
*
|
||||
* When jointype is INNER, joinqual and plan.qual are semantically
|
||||
* interchangeable. For OUTER jointypes, the two are *not* interchangeable;
|
||||
* only joinqual is used to determine whether a match has been found for
|
||||
* the purpose of deciding whether to generate null-extended tuples.
|
||||
* (But plan.qual is still applied before actually returning a tuple.)
|
||||
* For an outer join, only joinquals are allowed to be used as the merge
|
||||
* or hash condition of a merge or hash join.
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct Join
|
||||
{
|
||||
Plan plan;
|
||||
JoinType jointype;
|
||||
List *joinqual; /* JOIN quals (in addition to plan.qual) */
|
||||
} Join;
|
||||
|
||||
/* ----------------
|
||||
* nest loop join node
|
||||
*
|
||||
* The nestParams list identifies any executor Params that must be passed
|
||||
* into execution of the inner subplan carrying values from the current row
|
||||
* of the outer subplan. Currently we restrict these values to be simple
|
||||
* Vars, but perhaps someday that'd be worth relaxing. (Note: during plan
|
||||
* creation, the paramval can actually be a PlaceHolderVar expression; but it
|
||||
* must be a Var with varno OUTER_VAR by the time it gets to the executor.)
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct NestLoop
|
||||
{
|
||||
Join join;
|
||||
List *nestParams; /* list of NestLoopParam nodes */
|
||||
} NestLoop;
|
||||
|
||||
typedef struct NestLoopParam
|
||||
{
|
||||
NodeTag type;
|
||||
int paramno; /* number of the PARAM_EXEC Param to set */
|
||||
Var *paramval; /* outer-relation Var to assign to Param */
|
||||
} NestLoopParam;
|
||||
|
||||
/* ----------------
|
||||
* merge join node
|
||||
*
|
||||
* The expected ordering of each mergeable column is described by a btree
|
||||
* opfamily OID, a collation OID, a direction (BTLessStrategyNumber or
|
||||
* BTGreaterStrategyNumber) and a nulls-first flag. Note that the two sides
|
||||
* of each mergeclause may be of different datatypes, but they are ordered the
|
||||
* same way according to the common opfamily and collation. The operator in
|
||||
* each mergeclause must be an equality operator of the indicated opfamily.
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct MergeJoin
|
||||
{
|
||||
Join join;
|
||||
List *mergeclauses; /* mergeclauses as expression trees */
|
||||
/* these are arrays, but have the same length as the mergeclauses list: */
|
||||
Oid *mergeFamilies; /* per-clause OIDs of btree opfamilies */
|
||||
Oid *mergeCollations; /* per-clause OIDs of collations */
|
||||
int *mergeStrategies; /* per-clause ordering (ASC or DESC) */
|
||||
bool *mergeNullsFirst; /* per-clause nulls ordering */
|
||||
} MergeJoin;
|
||||
|
||||
/* ----------------
|
||||
* hash join node
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct HashJoin
|
||||
{
|
||||
Join join;
|
||||
List *hashclauses;
|
||||
} HashJoin;
|
||||
|
||||
/* ----------------
|
||||
* materialization node
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct Material
|
||||
{
|
||||
Plan plan;
|
||||
} Material;
|
||||
|
||||
/* ----------------
|
||||
* sort node
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct Sort
|
||||
{
|
||||
Plan plan;
|
||||
int numCols; /* number of sort-key columns */
|
||||
AttrNumber *sortColIdx; /* their indexes in the target list */
|
||||
Oid *sortOperators; /* OIDs of operators to sort them by */
|
||||
Oid *collations; /* OIDs of collations */
|
||||
bool *nullsFirst; /* NULLS FIRST/LAST directions */
|
||||
} Sort;
|
||||
|
||||
/* ---------------
|
||||
* group node -
|
||||
* Used for queries with GROUP BY (but no aggregates) specified.
|
||||
* The input must be presorted according to the grouping columns.
|
||||
* ---------------
|
||||
*/
|
||||
typedef struct Group
|
||||
{
|
||||
Plan plan;
|
||||
int numCols; /* number of grouping columns */
|
||||
AttrNumber *grpColIdx; /* their indexes in the target list */
|
||||
Oid *grpOperators; /* equality operators to compare with */
|
||||
} Group;
|
||||
|
||||
/* ---------------
|
||||
* aggregate node
|
||||
*
|
||||
* An Agg node implements plain or grouped aggregation. For grouped
|
||||
* aggregation, we can work with presorted input or unsorted input;
|
||||
* the latter strategy uses an internal hashtable.
|
||||
*
|
||||
* Notice the lack of any direct info about the aggregate functions to be
|
||||
* computed. They are found by scanning the node's tlist and quals during
|
||||
* executor startup. (It is possible that there are no aggregate functions;
|
||||
* this could happen if they get optimized away by constant-folding, or if
|
||||
* we are using the Agg node to implement hash-based grouping.)
|
||||
* ---------------
|
||||
*/
|
||||
typedef enum AggStrategy
|
||||
{
|
||||
AGG_PLAIN, /* simple agg across all input rows */
|
||||
AGG_SORTED, /* grouped agg, input must be sorted */
|
||||
AGG_HASHED /* grouped agg, use internal hashtable */
|
||||
} AggStrategy;
|
||||
|
||||
typedef struct Agg
|
||||
{
|
||||
Plan plan;
|
||||
AggStrategy aggstrategy;
|
||||
int numCols; /* number of grouping columns */
|
||||
AttrNumber *grpColIdx; /* their indexes in the target list */
|
||||
Oid *grpOperators; /* equality operators to compare with */
|
||||
long numGroups; /* estimated number of groups in input */
|
||||
} Agg;
|
||||
|
||||
/* ----------------
|
||||
* window aggregate node
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct WindowAgg
|
||||
{
|
||||
Plan plan;
|
||||
Index winref; /* ID referenced by window functions */
|
||||
int partNumCols; /* number of columns in partition clause */
|
||||
AttrNumber *partColIdx; /* their indexes in the target list */
|
||||
Oid *partOperators; /* equality operators for partition columns */
|
||||
int ordNumCols; /* number of columns in ordering clause */
|
||||
AttrNumber *ordColIdx; /* their indexes in the target list */
|
||||
Oid *ordOperators; /* equality operators for ordering columns */
|
||||
int frameOptions; /* frame_clause options, see WindowDef */
|
||||
Node *startOffset; /* expression for starting bound, if any */
|
||||
Node *endOffset; /* expression for ending bound, if any */
|
||||
} WindowAgg;
|
||||
|
||||
/* ----------------
|
||||
* unique node
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct Unique
|
||||
{
|
||||
Plan plan;
|
||||
int numCols; /* number of columns to check for uniqueness */
|
||||
AttrNumber *uniqColIdx; /* their indexes in the target list */
|
||||
Oid *uniqOperators; /* equality operators to compare with */
|
||||
} Unique;
|
||||
|
||||
/* ----------------
|
||||
* hash build node
|
||||
*
|
||||
* If the executor is supposed to try to apply skew join optimization, then
|
||||
* skewTable/skewColumn/skewInherit identify the outer relation's join key
|
||||
* column, from which the relevant MCV statistics can be fetched. Also, its
|
||||
* type information is provided to save a lookup.
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct Hash
|
||||
{
|
||||
Plan plan;
|
||||
Oid skewTable; /* outer join key's table OID, or InvalidOid */
|
||||
AttrNumber skewColumn; /* outer join key's column #, or zero */
|
||||
bool skewInherit; /* is outer join rel an inheritance tree? */
|
||||
Oid skewColType; /* datatype of the outer key column */
|
||||
int32 skewColTypmod; /* typmod of the outer key column */
|
||||
/* all other info is in the parent HashJoin node */
|
||||
} Hash;
|
||||
|
||||
/* ----------------
|
||||
* setop node
|
||||
* ----------------
|
||||
*/
|
||||
typedef enum SetOpCmd
|
||||
{
|
||||
SETOPCMD_INTERSECT,
|
||||
SETOPCMD_INTERSECT_ALL,
|
||||
SETOPCMD_EXCEPT,
|
||||
SETOPCMD_EXCEPT_ALL
|
||||
} SetOpCmd;
|
||||
|
||||
typedef enum SetOpStrategy
|
||||
{
|
||||
SETOP_SORTED, /* input must be sorted */
|
||||
SETOP_HASHED /* use internal hashtable */
|
||||
} SetOpStrategy;
|
||||
|
||||
typedef struct SetOp
|
||||
{
|
||||
Plan plan;
|
||||
SetOpCmd cmd; /* what to do */
|
||||
SetOpStrategy strategy; /* how to do it */
|
||||
int numCols; /* number of columns to check for
|
||||
* duplicate-ness */
|
||||
AttrNumber *dupColIdx; /* their indexes in the target list */
|
||||
Oid *dupOperators; /* equality operators to compare with */
|
||||
AttrNumber flagColIdx; /* where is the flag column, if any */
|
||||
int firstFlag; /* flag value for first input relation */
|
||||
long numGroups; /* estimated number of groups in input */
|
||||
} SetOp;
|
||||
|
||||
/* ----------------
|
||||
* lock-rows node
|
||||
*
|
||||
* rowMarks identifies the rels to be locked by this node; it should be
|
||||
* a subset of the rowMarks listed in the top-level PlannedStmt.
|
||||
* epqParam is a Param that all scan nodes below this one must depend on.
|
||||
* It is used to force re-evaluation of the plan during EvalPlanQual.
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct LockRows
|
||||
{
|
||||
Plan plan;
|
||||
List *rowMarks; /* a list of PlanRowMark's */
|
||||
int epqParam; /* ID of Param for EvalPlanQual re-eval */
|
||||
} LockRows;
|
||||
|
||||
/* ----------------
|
||||
* limit node
|
||||
*
|
||||
* Note: as of Postgres 8.2, the offset and count expressions are expected
|
||||
* to yield int8, rather than int4 as before.
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct Limit
|
||||
{
|
||||
Plan plan;
|
||||
Node *limitOffset; /* OFFSET parameter, or NULL if none */
|
||||
Node *limitCount; /* COUNT parameter, or NULL if none */
|
||||
} Limit;
|
||||
|
||||
|
||||
/*
|
||||
* RowMarkType -
|
||||
* enums for types of row-marking operations
|
||||
*
|
||||
* When doing UPDATE, DELETE, or SELECT FOR UPDATE/SHARE, we have to uniquely
|
||||
* identify all the source rows, not only those from the target relations, so
|
||||
* that we can perform EvalPlanQual rechecking at need. For plain tables we
|
||||
* can just fetch the TID, the same as for a target relation. Otherwise (for
|
||||
* example for VALUES or FUNCTION scans) we have to copy the whole row value.
|
||||
* The latter is pretty inefficient but fortunately the case is not
|
||||
* performance-critical in practice.
|
||||
*/
|
||||
typedef enum RowMarkType
|
||||
{
|
||||
ROW_MARK_EXCLUSIVE, /* obtain exclusive tuple lock */
|
||||
ROW_MARK_SHARE, /* obtain shared tuple lock */
|
||||
ROW_MARK_REFERENCE, /* just fetch the TID */
|
||||
ROW_MARK_COPY /* physically copy the row value */
|
||||
} RowMarkType;
|
||||
|
||||
#define RowMarkRequiresRowShareLock(marktype) ((marktype) <= ROW_MARK_SHARE)
|
||||
|
||||
/*
|
||||
* PlanRowMark -
|
||||
* plan-time representation of FOR UPDATE/SHARE clauses
|
||||
*
|
||||
* When doing UPDATE, DELETE, or SELECT FOR UPDATE/SHARE, we create a separate
|
||||
* PlanRowMark node for each non-target relation in the query. Relations that
|
||||
* are not specified as FOR UPDATE/SHARE are marked ROW_MARK_REFERENCE (if
|
||||
* real tables) or ROW_MARK_COPY (if not).
|
||||
*
|
||||
* Initially all PlanRowMarks have rti == prti and isParent == false.
|
||||
* When the planner discovers that a relation is the root of an inheritance
|
||||
* tree, it sets isParent true, and adds an additional PlanRowMark to the
|
||||
* list for each child relation (including the target rel itself in its role
|
||||
* as a child). The child entries have rti == child rel's RT index and
|
||||
* prti == parent's RT index, and can therefore be recognized as children by
|
||||
* the fact that prti != rti.
|
||||
*
|
||||
* The planner also adds resjunk output columns to the plan that carry
|
||||
* information sufficient to identify the locked or fetched rows. For
|
||||
* tables (markType != ROW_MARK_COPY), these columns are named
|
||||
* tableoid%u OID of table
|
||||
* ctid%u TID of row
|
||||
* The tableoid column is only present for an inheritance hierarchy.
|
||||
* When markType == ROW_MARK_COPY, there is instead a single column named
|
||||
* wholerow%u whole-row value of relation
|
||||
* In all three cases, %u represents the rowmark ID number (rowmarkId).
|
||||
* This number is unique within a plan tree, except that child relation
|
||||
* entries copy their parent's rowmarkId. (Assigning unique numbers
|
||||
* means we needn't renumber rowmarkIds when flattening subqueries, which
|
||||
* would require finding and renaming the resjunk columns as well.)
|
||||
* Note this means that all tables in an inheritance hierarchy share the
|
||||
* same resjunk column names. However, in an inherited UPDATE/DELETE the
|
||||
* columns could have different physical column numbers in each subplan.
|
||||
*/
|
||||
typedef struct PlanRowMark
|
||||
{
|
||||
NodeTag type;
|
||||
Index rti; /* range table index of markable relation */
|
||||
Index prti; /* range table index of parent relation */
|
||||
Index rowmarkId; /* unique identifier for resjunk columns */
|
||||
RowMarkType markType; /* see enum above */
|
||||
bool noWait; /* NOWAIT option */
|
||||
bool isParent; /* true if this is a "dummy" parent entry */
|
||||
} PlanRowMark;
|
||||
|
||||
|
||||
/*
|
||||
* Plan invalidation info
|
||||
*
|
||||
* We track the objects on which a PlannedStmt depends in two ways:
|
||||
* relations are recorded as a simple list of OIDs, and everything else
|
||||
* is represented as a list of PlanInvalItems. A PlanInvalItem is designed
|
||||
* to be used with the syscache invalidation mechanism, so it identifies a
|
||||
* system catalog entry by cache ID and hash value.
|
||||
*/
|
||||
typedef struct PlanInvalItem
|
||||
{
|
||||
NodeTag type;
|
||||
int cacheId; /* a syscache ID, see utils/syscache.h */
|
||||
uint32 hashValue; /* hash value of object's cache lookup key */
|
||||
} PlanInvalItem;
|
||||
|
||||
#endif /* PLANNODES_H */
|
||||
1280
pg_include/nodes/primnodes.h
Executable file
1280
pg_include/nodes/primnodes.h
Executable file
File diff suppressed because it is too large
Load Diff
34
pg_include/nodes/print.h
Executable file
34
pg_include/nodes/print.h
Executable file
@@ -0,0 +1,34 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* print.h
|
||||
* definitions for nodes/print.c
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/nodes/print.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef PRINT_H
|
||||
#define PRINT_H
|
||||
|
||||
#include "executor/tuptable.h"
|
||||
|
||||
|
||||
#define nodeDisplay(x) pprint(x)
|
||||
|
||||
extern void print(const void *obj);
|
||||
extern void pprint(const void *obj);
|
||||
extern void elog_node_display(int lev, const char *title,
|
||||
const void *obj, bool pretty);
|
||||
extern char *format_node_dump(const char *dump);
|
||||
extern char *pretty_format_node_dump(const char *dump);
|
||||
extern void print_rt(const List *rtable);
|
||||
extern void print_expr(const Node *expr, const List *rtable);
|
||||
extern void print_pathkeys(const List *pathkeys, const List *rtable);
|
||||
extern void print_tl(const List *tlist, const List *rtable);
|
||||
extern void print_slot(TupleTableSlot *slot);
|
||||
|
||||
#endif /* PRINT_H */
|
||||
31
pg_include/nodes/readfuncs.h
Executable file
31
pg_include/nodes/readfuncs.h
Executable file
@@ -0,0 +1,31 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/nodes/readfuncs.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef READFUNCS_H
|
||||
#define READFUNCS_H
|
||||
|
||||
#include "nodes/nodes.h"
|
||||
|
||||
/*
|
||||
* prototypes for functions in read.c (the lisp token parser)
|
||||
*/
|
||||
extern char *pg_strtok(int *length);
|
||||
extern char *debackslash(char *token, int length);
|
||||
extern void *nodeRead(char *token, int tok_len);
|
||||
|
||||
/*
|
||||
* prototypes for functions in readfuncs.c
|
||||
*/
|
||||
extern Node *parseNodeString(void);
|
||||
|
||||
#endif /* READFUNCS_H */
|
||||
1588
pg_include/nodes/relation.h
Executable file
1588
pg_include/nodes/relation.h
Executable file
File diff suppressed because it is too large
Load Diff
52
pg_include/nodes/replnodes.h
Executable file
52
pg_include/nodes/replnodes.h
Executable file
@@ -0,0 +1,52 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* replnodes.h
|
||||
* definitions for replication grammar parse nodes
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/nodes/replnodes.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef REPLNODES_H
|
||||
#define REPLNODES_H
|
||||
|
||||
#include "access/xlogdefs.h"
|
||||
#include "nodes/pg_list.h"
|
||||
|
||||
|
||||
/* ----------------------
|
||||
* IDENTIFY_SYSTEM command
|
||||
* ----------------------
|
||||
*/
|
||||
typedef struct IdentifySystemCmd
|
||||
{
|
||||
NodeTag type;
|
||||
} IdentifySystemCmd;
|
||||
|
||||
|
||||
/* ----------------------
|
||||
* BASE_BACKUP command
|
||||
* ----------------------
|
||||
*/
|
||||
typedef struct BaseBackupCmd
|
||||
{
|
||||
NodeTag type;
|
||||
List *options;
|
||||
} BaseBackupCmd;
|
||||
|
||||
|
||||
/* ----------------------
|
||||
* START_REPLICATION command
|
||||
* ----------------------
|
||||
*/
|
||||
typedef struct StartReplicationCmd
|
||||
{
|
||||
NodeTag type;
|
||||
XLogRecPtr startpoint;
|
||||
} StartReplicationCmd;
|
||||
|
||||
#endif /* REPLNODES_H */
|
||||
66
pg_include/nodes/tidbitmap.h
Executable file
66
pg_include/nodes/tidbitmap.h
Executable file
@@ -0,0 +1,66 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* tidbitmap.h
|
||||
* PostgreSQL tuple-id (TID) bitmap package
|
||||
*
|
||||
* This module provides bitmap data structures that are spiritually
|
||||
* similar to Bitmapsets, but are specially adapted to store sets of
|
||||
* tuple identifiers (TIDs), or ItemPointers. In particular, the division
|
||||
* of an ItemPointer into BlockNumber and OffsetNumber is catered for.
|
||||
* Also, since we wish to be able to store very large tuple sets in
|
||||
* memory with this data structure, we support "lossy" storage, in which
|
||||
* we no longer remember individual tuple offsets on a page but only the
|
||||
* fact that a particular page needs to be visited.
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2003-2012, PostgreSQL Global Development Group
|
||||
*
|
||||
* src/include/nodes/tidbitmap.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef TIDBITMAP_H
|
||||
#define TIDBITMAP_H
|
||||
|
||||
#include "storage/itemptr.h"
|
||||
|
||||
|
||||
/*
|
||||
* Actual bitmap representation is private to tidbitmap.c. Callers can
|
||||
* do IsA(x, TIDBitmap) on it, but nothing else.
|
||||
*/
|
||||
typedef struct TIDBitmap TIDBitmap;
|
||||
|
||||
/* Likewise, TBMIterator is private */
|
||||
typedef struct TBMIterator TBMIterator;
|
||||
|
||||
/* Result structure for tbm_iterate */
|
||||
typedef struct
|
||||
{
|
||||
BlockNumber blockno; /* page number containing tuples */
|
||||
int ntuples; /* -1 indicates lossy result */
|
||||
bool recheck; /* should the tuples be rechecked? */
|
||||
/* Note: recheck is always true if ntuples < 0 */
|
||||
OffsetNumber offsets[1]; /* VARIABLE LENGTH ARRAY */
|
||||
} TBMIterateResult; /* VARIABLE LENGTH STRUCT */
|
||||
|
||||
/* function prototypes in nodes/tidbitmap.c */
|
||||
|
||||
extern TIDBitmap *tbm_create(long maxbytes);
|
||||
extern void tbm_free(TIDBitmap *tbm);
|
||||
|
||||
extern void tbm_add_tuples(TIDBitmap *tbm,
|
||||
const ItemPointer tids, int ntids,
|
||||
bool recheck);
|
||||
extern void tbm_add_page(TIDBitmap *tbm, BlockNumber pageno);
|
||||
|
||||
extern void tbm_union(TIDBitmap *a, const TIDBitmap *b);
|
||||
extern void tbm_intersect(TIDBitmap *a, const TIDBitmap *b);
|
||||
|
||||
extern bool tbm_is_empty(const TIDBitmap *tbm);
|
||||
|
||||
extern TBMIterator *tbm_begin_iterate(TIDBitmap *tbm);
|
||||
extern TBMIterateResult *tbm_iterate(TBMIterator *iterator);
|
||||
extern void tbm_end_iterate(TBMIterator *iterator);
|
||||
|
||||
#endif /* TIDBITMAP_H */
|
||||
61
pg_include/nodes/value.h
Executable file
61
pg_include/nodes/value.h
Executable file
@@ -0,0 +1,61 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* value.h
|
||||
* interface for Value nodes
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2003-2012, PostgreSQL Global Development Group
|
||||
*
|
||||
* src/include/nodes/value.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef VALUE_H
|
||||
#define VALUE_H
|
||||
|
||||
#include "nodes/nodes.h"
|
||||
|
||||
/*----------------------
|
||||
* Value node
|
||||
*
|
||||
* The same Value struct is used for five node types: T_Integer,
|
||||
* T_Float, T_String, T_BitString, T_Null.
|
||||
*
|
||||
* Integral values are actually represented by a machine integer,
|
||||
* but both floats and strings are represented as strings.
|
||||
* Using T_Float as the node type simply indicates that
|
||||
* the contents of the string look like a valid numeric literal.
|
||||
*
|
||||
* (Before Postgres 7.0, we used a double to represent T_Float,
|
||||
* but that creates loss-of-precision problems when the value is
|
||||
* ultimately destined to be converted to NUMERIC. Since Value nodes
|
||||
* are only used in the parsing process, not for runtime data, it's
|
||||
* better to use the more general representation.)
|
||||
*
|
||||
* Note that an integer-looking string will get lexed as T_Float if
|
||||
* the value is too large to fit in a 'long'.
|
||||
*
|
||||
* Nulls, of course, don't need the value part at all.
|
||||
*----------------------
|
||||
*/
|
||||
typedef struct Value
|
||||
{
|
||||
NodeTag type; /* tag appropriately (eg. T_String) */
|
||||
union ValUnion
|
||||
{
|
||||
long ival; /* machine integer */
|
||||
char *str; /* string */
|
||||
} val;
|
||||
} Value;
|
||||
|
||||
#define intVal(v) (((Value *)(v))->val.ival)
|
||||
#define floatVal(v) atof(((Value *)(v))->val.str)
|
||||
#define strVal(v) (((Value *)(v))->val.str)
|
||||
|
||||
extern Value *makeInteger(long i);
|
||||
extern Value *makeFloat(char *numericStr);
|
||||
extern Value *makeString(char *str);
|
||||
extern Value *makeBitString(char *str);
|
||||
|
||||
#endif /* VALUE_H */
|
||||
Reference in New Issue
Block a user