⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 primnodes.h

📁 PostgreSQL 8.1.4的源码 适用于Linux下的开源数据库系统
💻 H
📖 第 1 页 / 共 3 页
字号:
/*------------------------------------------------------------------------- * * primnodes.h *	  Definitions for "primitive" node types, those that are used in more *	  than one of the parse/plan/execute stages of the query pipeline. *	  Currently, these are mostly nodes for executable expressions *	  and join trees. * * * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * $PostgreSQL: pgsql/src/include/nodes/primnodes.h,v 1.109 2005/10/15 02:49:45 momjian Exp $ * *------------------------------------------------------------------------- */#ifndef PRIMNODES_H#define PRIMNODES_H#include "access/attnum.h"#include "nodes/pg_list.h"#include "nodes/value.h"/* ---------------------------------------------------------------- *						node definitions * ---------------------------------------------------------------- *//* * Alias - *	  specifies an alias for a range variable; the alias might also *	  specify renaming of columns within the table. * * Note: colnames is a list of Value nodes (always strings).  In Alias structs * associated with RTEs, there may be entries corresponding to dropped * columns; these are normally empty strings ("").	See parsenodes.h for info. */typedef struct Alias{	NodeTag		type;	char	   *aliasname;		/* aliased rel name (never qualified) */	List	   *colnames;		/* optional list of column aliases */} Alias;typedef enum InhOption{	INH_NO,						/* Do NOT scan child tables */	INH_YES,					/* DO scan child tables */	INH_DEFAULT					/* Use current SQL_inheritance option */} InhOption;/* * RangeVar - range variable, used in FROM clauses * * Also used to represent table names in utility statements; there, the alias * field is not used, and inhOpt shows whether to apply the operation * recursively to child tables.  In some contexts it is also useful to carry * a TEMP table indication here. */typedef struct RangeVar{	NodeTag		type;	char	   *catalogname;	/* the catalog (database) name, or NULL */	char	   *schemaname;		/* the schema name, or NULL */	char	   *relname;		/* the relation/sequence name */	InhOption	inhOpt;			/* expand rel by inheritance? recursively act								 * on children? */	bool		istemp;			/* is this a temp relation/sequence? */	Alias	   *alias;			/* table alias & optional column aliases */} RangeVar;/* ---------------------------------------------------------------- *					node types for executable expressions * ---------------------------------------------------------------- *//* * Expr - generic superclass for executable-expression nodes * * All node types that are used in executable expression trees should derive * from Expr (that is, have Expr as their first field).  Since Expr only * contains NodeTag, this is a formality, but it is an easy form of * documentation.  See also the ExprState node types in execnodes.h. */typedef struct Expr{	NodeTag		type;} Expr;/* * Var - expression node representing a variable (ie, a table column) * * Note: during parsing/planning, varnoold/varoattno are always just copies * of varno/varattno.  At the tail end of planning, Var nodes appearing in * upper-level plan nodes are reassigned to point to the outputs of their * subplans; for example, in a join node varno becomes INNER or OUTER and * varattno becomes the index of the proper element of that subplan's target * list.  But varnoold/varoattno continue to hold the original values. * The code doesn't really need varnoold/varoattno, but they are very useful * for debugging and interpreting completed plans, so we keep them around. */#define    INNER		65000#define    OUTER		65001#define    PRS2_OLD_VARNO			1#define    PRS2_NEW_VARNO			2typedef struct Var{	Expr		xpr;	Index		varno;			/* index of this var's relation in the range								 * table (could also be INNER or OUTER) */	AttrNumber	varattno;		/* attribute number of this var, or zero for								 * all */	Oid			vartype;		/* pg_type tuple OID for the type of this var */	int32		vartypmod;		/* pg_attribute typmod value */	Index		varlevelsup;	/*	 * for subquery variables referencing outer relations; 0 in a normal var,	 * >0 means N levels up	 */	Index		varnoold;		/* original value of varno, for debugging */	AttrNumber	varoattno;		/* original value of varattno */} Var;/* * Const */typedef struct Const{	Expr		xpr;	Oid			consttype;		/* PG_TYPE OID of the constant's datatype */	int			constlen;		/* typlen of the constant's datatype */	Datum		constvalue;		/* the constant's value */	bool		constisnull;	/* whether the constant is null (if true,								 * constvalue is undefined) */	bool		constbyval;		/* whether this datatype is 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. */} 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_EXEC:  The parameter is an internal executor parameter. *				It has a number contained in the `paramid' field. * ---------------- */typedef struct Param{	Expr		xpr;	int			paramkind;		/* kind of parameter. See above */	AttrNumber	paramid;		/* numeric ID for parameter ("$1") */	char	   *paramname;		/* name for parameter ("$.foo") */	Oid			paramtype;		/* PG_TYPE OID of parameter's datatype */} Param;/* * Aggref */typedef struct Aggref{	Expr		xpr;	Oid			aggfnoid;		/* pg_proc Oid of the aggregate */	Oid			aggtype;		/* type Oid of result of the aggregate */	Expr	   *target;			/* expression we are aggregating on */	Index		agglevelsup;	/* > 0 if agg belongs to outer query */	bool		aggstar;		/* TRUE if argument was really '*' */	bool		aggdistinct;	/* TRUE if it's agg(DISTINCT ...) */} Aggref;/* ---------------- *	ArrayRef: describes an array subscripting operation * * An ArrayRef can describe fetching a single element from an array, * fetching a subarray (array slice), storing a single element into * an array, or storing a slice.  The "store" cases work with an * initial array value and a source value that is inserted into the * appropriate part of the array; the result of the operation is an * entire new modified array value. * * If reflowerindexpr = NIL, then we are fetching or storing a single array * element at the subscripts given by refupperindexpr.	Otherwise we are * fetching or storing an array slice, that is a rectangular subarray * with lower and upper bounds given by the index expressions. * reflowerindexpr must be the same length as refupperindexpr when it * is not NIL. * * Note: refrestype is NOT the element type, but the array type, * when doing subarray fetch or either type of store. * ---------------- */typedef struct ArrayRef{	Expr		xpr;	Oid			refrestype;		/* type of the result of the ArrayRef								 * operation */	Oid			refarraytype;	/* type of the array proper */	Oid			refelemtype;	/* type of the array elements */	List	   *refupperindexpr;/* expressions that evaluate to upper array								 * indexes */	List	   *reflowerindexpr;/* expressions that evaluate to lower array								 * indexes */	Expr	   *refexpr;		/* the expression that evaluates to an array								 * value */	Expr	   *refassgnexpr;	/* expression for the source value, or NULL if								 * fetch */} ArrayRef;/* * CoercionContext - distinguishes the allowed set of type casts * * NB: ordering of the alternatives is significant; later (larger) values * allow more casts than earlier ones. */typedef enum CoercionContext{	COERCION_IMPLICIT,			/* coercion in context of expression */	COERCION_ASSIGNMENT,		/* coercion in context of assignment */	COERCION_EXPLICIT			/* explicit cast operation */} CoercionContext;/* * CoercionForm - information showing how to display a function-call node */typedef enum CoercionForm{	COERCE_EXPLICIT_CALL,		/* display as a function call */	COERCE_EXPLICIT_CAST,		/* display as an explicit cast */	COERCE_IMPLICIT_CAST,		/* implicit cast, so hide it */	COERCE_DONTCARE				/* special case for planner */} CoercionForm;/* * FuncExpr - expression node for a function call */typedef struct FuncExpr{	Expr		xpr;	Oid			funcid;			/* PG_PROC OID of the function */	Oid			funcresulttype; /* PG_TYPE OID of result value */	bool		funcretset;		/* true if function returns set */	CoercionForm funcformat;	/* how to display this function call */	List	   *args;			/* arguments to the function */} FuncExpr;/* * OpExpr - expression node for an operator invocation * * Semantically, this is essentially the same as a function call. * * Note that opfuncid is not necessarily filled in immediately on creation * of the node.  The planner makes sure it is valid before passing the node * tree to the executor, but during parsing/planning opfuncid is typically 0. */typedef struct OpExpr{	Expr		xpr;	Oid			opno;			/* PG_OPERATOR OID of the operator */	Oid			opfuncid;		/* PG_PROC OID of underlying function */	Oid			opresulttype;	/* PG_TYPE OID of result value */	bool		opretset;		/* true if operator returns set */	List	   *args;			/* arguments to the operator (1 or 2) */} OpExpr;/* * DistinctExpr - expression node for "x IS DISTINCT FROM y" * * Except for the nodetag, this is represented identically to an OpExpr * referencing the "=" operator for x and y. * We use "=", not the more obvious "<>", because more datatypes have "=" * than "<>".  This means the executor must invert the operator result. * Note that the operator function won't be called at all if either input * is NULL, since then the result can be determined directly. */typedef OpExpr DistinctExpr;/* * ScalarArrayOpExpr - expression node for "scalar op ANY/ALL (array)" * * The operator must yield boolean.  It is applied to the left operand * and each element of the righthand array, and the results are combined * with OR or AND (for ANY or ALL respectively).  The node representation * is almost the same as for the underlying operator, but we need a useOr * flag to remember whether it's ANY or ALL, and we don't have to store * the result type because it must be boolean. */typedef struct ScalarArrayOpExpr{	Expr		xpr;	Oid			opno;			/* PG_OPERATOR OID of the operator */	Oid			opfuncid;		/* PG_PROC OID of underlying function */	bool		useOr;			/* true for ANY, false for ALL */	List	   *args;			/* the scalar and array operands */} ScalarArrayOpExpr;/* * BoolExpr - expression node for the basic Boolean operators AND, OR, NOT *

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -