parsenodes.h

来自「PostgreSQL7.4.6 for Linux」· C头文件 代码 · 共 1,701 行 · 第 1/4 页

H
1,701
字号
/* ---------------------- *		Copy Statement * ---------------------- */typedef struct CopyStmt{	NodeTag		type;	RangeVar   *relation;		/* the relation to copy */	List	   *attlist;		/* List of column names (as Strings), or								 * NIL for all columns */	bool		is_from;		/* TO or FROM */	char	   *filename;		/* if NULL, use stdin/stdout */	List	   *options;		/* List of DefElem nodes */} CopyStmt;/* ---------------------- *		Create Table Statement * * NOTE: in the raw gram.y output, ColumnDef, Constraint, and FkConstraint * nodes are intermixed in tableElts, and constraints is NIL.  After parse * analysis, tableElts contains just ColumnDefs, and constraints contains * just Constraint nodes (in fact, only CONSTR_CHECK nodes, in the present * implementation). * ---------------------- *//* What to do at commit time for temporary relations */typedef enum OnCommitAction{	ONCOMMIT_NOOP,				/* No ON COMMIT clause (do nothing) */	ONCOMMIT_PRESERVE_ROWS,		/* ON COMMIT PRESERVE ROWS (do nothing) */	ONCOMMIT_DELETE_ROWS,		/* ON COMMIT DELETE ROWS */	ONCOMMIT_DROP				/* ON COMMIT DROP */} OnCommitAction;typedef struct CreateStmt{	NodeTag		type;	RangeVar   *relation;		/* relation to create */	List	   *tableElts;		/* column definitions (list of ColumnDef) */	List	   *inhRelations;	/* relations to inherit from (list of								 * inhRelation) */	List	   *constraints;	/* constraints (list of Constraint nodes) */	bool		hasoids;		/* should it have OIDs? */	OnCommitAction oncommit;	/* what do we do at COMMIT? */} CreateStmt;/* ---------- * Definitions for plain (non-FOREIGN KEY) constraints in CreateStmt * * XXX probably these ought to be unified with FkConstraints at some point? * * For constraints that use expressions (CONSTR_DEFAULT, CONSTR_CHECK) * we may have the expression in either "raw" form (an untransformed * parse tree) or "cooked" form (the nodeToString representation of * an executable expression tree), depending on how this Constraint * node was created (by parsing, or by inheritance from an existing * relation).  We should never have both in the same node! * * Constraint attributes (DEFERRABLE etc) are initially represented as * separate Constraint nodes for simplicity of parsing.  analyze.c makes * a pass through the constraints list to attach the info to the appropriate * FkConstraint node (and, perhaps, someday to other kinds of constraints). * ---------- */typedef enum ConstrType			/* types of constraints */{	CONSTR_NULL,				/* not SQL92, but a lot of people expect								 * it */	CONSTR_NOTNULL,	CONSTR_DEFAULT,	CONSTR_CHECK,	CONSTR_PRIMARY,	CONSTR_UNIQUE,	CONSTR_ATTR_DEFERRABLE,		/* attributes for previous constraint node */	CONSTR_ATTR_NOT_DEFERRABLE,	CONSTR_ATTR_DEFERRED,	CONSTR_ATTR_IMMEDIATE} ConstrType;typedef struct Constraint{	NodeTag		type;	ConstrType	contype;	char	   *name;			/* name, or NULL if unnamed */	Node	   *raw_expr;		/* expr, as untransformed parse tree */	char	   *cooked_expr;	/* expr, as nodeToString representation */	List	   *keys;			/* String nodes naming referenced								 * column(s) */} Constraint;/* ---------- * Definitions for FOREIGN KEY constraints in CreateStmt * * Note: FKCONSTR_ACTION_xxx values are stored into pg_constraint.confupdtype * and pg_constraint.confdeltype columns; FKCONSTR_MATCH_xxx values are * stored into pg_constraint.confmatchtype.  Changing the code values may * require an initdb! * * If skip_validation is true then we skip checking that the existing rows * in the table satisfy the constraint, and just install the catalog entries * for the constraint.	This is currently used only during CREATE TABLE * (when we know the table must be empty). * ---------- */#define FKCONSTR_ACTION_NOACTION	'a'#define FKCONSTR_ACTION_RESTRICT	'r'#define FKCONSTR_ACTION_CASCADE		'c'#define FKCONSTR_ACTION_SETNULL		'n'#define FKCONSTR_ACTION_SETDEFAULT	'd'#define FKCONSTR_MATCH_FULL			'f'#define FKCONSTR_MATCH_PARTIAL		'p'#define FKCONSTR_MATCH_UNSPECIFIED	'u'typedef struct FkConstraint{	NodeTag		type;	char	   *constr_name;	/* Constraint name, or NULL if unnamed */	RangeVar   *pktable;		/* Primary key table */	List	   *fk_attrs;		/* Attributes of foreign key */	List	   *pk_attrs;		/* Corresponding attrs in PK table */	char		fk_matchtype;	/* FULL, PARTIAL, UNSPECIFIED */	char		fk_upd_action;	/* ON UPDATE action */	char		fk_del_action;	/* ON DELETE action */	bool		deferrable;		/* DEFERRABLE */	bool		initdeferred;	/* INITIALLY DEFERRED */	bool		skip_validation;	/* skip validation of existing rows? */} FkConstraint;/* ---------------------- *		Create/Drop TRIGGER Statements * ---------------------- */typedef struct CreateTrigStmt{	NodeTag		type;	char	   *trigname;		/* TRIGGER's name */	RangeVar   *relation;		/* relation trigger is on */	List	   *funcname;		/* qual. name of function to call */	List	   *args;			/* list of (T_String) Values or NIL */	bool		before;			/* BEFORE/AFTER */	bool		row;			/* ROW/STATEMENT */	char		actions[4];		/* 1 to 3 of 'i', 'u', 'd', + trailing \0 */	/* The following are used for referential */	/* integrity constraint triggers */	bool		isconstraint;	/* This is an RI trigger */	bool		deferrable;		/* [NOT] DEFERRABLE */	bool		initdeferred;	/* INITIALLY {DEFERRED|IMMEDIATE} */	RangeVar   *constrrel;		/* opposite relation */} CreateTrigStmt;/* ---------------------- *		Create/Drop PROCEDURAL LANGUAGE Statement * ---------------------- */typedef struct CreatePLangStmt{	NodeTag		type;	char	   *plname;			/* PL name */	List	   *plhandler;		/* PL call handler function (qual. name) */	List	   *plvalidator;	/* optional validator function (qual.								 * name) */	bool		pltrusted;		/* PL is trusted */} CreatePLangStmt;typedef struct DropPLangStmt{	NodeTag		type;	char	   *plname;			/* PL name */	DropBehavior behavior;		/* RESTRICT or CASCADE behavior */} DropPLangStmt;/* ---------------------- *	Create/Alter/Drop User Statements * ---------------------- */typedef struct CreateUserStmt{	NodeTag		type;	char	   *user;			/* PostgreSQL user login name */	List	   *options;		/* List of DefElem nodes */} CreateUserStmt;typedef struct AlterUserStmt{	NodeTag		type;	char	   *user;			/* PostgreSQL user login name */	List	   *options;		/* List of DefElem nodes */} AlterUserStmt;typedef struct AlterUserSetStmt{	NodeTag		type;	char	   *user;	char	   *variable;	List	   *value;} AlterUserSetStmt;typedef struct DropUserStmt{	NodeTag		type;	List	   *users;			/* List of users to remove */} DropUserStmt;/* ---------------------- *		Create/Alter/Drop Group Statements * ---------------------- */typedef struct CreateGroupStmt{	NodeTag		type;	char	   *name;			/* name of the new group */	List	   *options;		/* List of DefElem nodes */} CreateGroupStmt;typedef struct AlterGroupStmt{	NodeTag		type;	char	   *name;			/* name of group to alter */	int			action;			/* +1 = add, -1 = drop user */	List	   *listUsers;		/* list of users to add/drop */} AlterGroupStmt;typedef struct DropGroupStmt{	NodeTag		type;	char	   *name;} DropGroupStmt;/* ---------------------- *		{Create|Alter} SEQUENCE Statement * ---------------------- */typedef struct CreateSeqStmt{	NodeTag		type;	RangeVar   *sequence;		/* the sequence to create */	List	   *options;} CreateSeqStmt;typedef struct AlterSeqStmt{	NodeTag		type;	RangeVar   *sequence;		/* the sequence to alter */	List	   *options;} AlterSeqStmt;/* ---------------------- *		Create {Aggregate|Operator|Type} Statement * ---------------------- */typedef struct DefineStmt{	NodeTag		type;	ObjectType	kind;			/* aggregate, operator, type */	List	   *defnames;		/* qualified name (list of Value strings) */	List	   *definition;		/* a list of DefElem */} DefineStmt;/* ---------------------- *		Create Domain Statement * ---------------------- */typedef struct CreateDomainStmt{	NodeTag		type;	List	   *domainname;		/* qualified name (list of Value strings) */	TypeName   *typename;		/* the base type */	List	   *constraints;	/* constraints (list of Constraint nodes) */} CreateDomainStmt;/* ---------------------- *		Create Operator Class Statement * ---------------------- */typedef struct CreateOpClassStmt{	NodeTag		type;	List	   *opclassname;	/* qualified name (list of Value strings) */	char	   *amname;			/* name of index AM opclass is for */	TypeName   *datatype;		/* datatype of indexed column */	List	   *items;			/* List of CreateOpClassItem nodes */	bool		isDefault;		/* Should be marked as default for type? */} CreateOpClassStmt;#define OPCLASS_ITEM_OPERATOR		1#define OPCLASS_ITEM_FUNCTION		2#define OPCLASS_ITEM_STORAGETYPE	3typedef struct CreateOpClassItem{	NodeTag		type;	int			itemtype;		/* see codes above */	/* fields used for an operator or function item: */	List	   *name;			/* operator or function name */	List	   *args;			/* argument types */	int			number;			/* strategy num or support proc num */	bool		recheck;		/* only used for operators */	/* fields used for a storagetype item: */	TypeName   *storedtype;		/* datatype stored in index */} CreateOpClassItem;/* ---------------------- *		Drop Table|Sequence|View|Index|Type|Domain|Conversion|Schema Statement * ---------------------- */typedef struct DropStmt{	NodeTag		type;	List	   *objects;		/* list of sublists of names (as Values) */	ObjectType	removeType;		/* object type */	DropBehavior behavior;		/* RESTRICT or CASCADE behavior */} DropStmt;/* ---------------------- *		Drop Rule|Trigger Statement * * In general this may be used for dropping any property of a relation; * for example, someday soon we may have DROP ATTRIBUTE. * ---------------------- */typedef struct DropPropertyStmt{	NodeTag		type;	RangeVar   *relation;		/* owning relation */	char	   *property;		/* name of rule, trigger, etc */	ObjectType	removeType;		/* OBJECT_RULE or OBJECT_TRIGGER */	DropBehavior behavior;		/* RESTRICT or CASCADE behavior */} DropPropertyStmt;/* ---------------------- *				Truncate Table Statement * ---------------------- */typedef struct TruncateStmt{	NodeTag		type;	RangeVar   *relation;		/* relation to be truncated */} TruncateStmt;/* ---------------------- *				Comment On Statement * ---------------------- */typedef struct CommentStmt{	NodeTag		type;	ObjectType	objtype;		/* Object's type */	List	   *objname;		/* Qualified name of the object */	List	   *objargs;		/* Arguments if needed (eg, for functions) */	char	   *comment;		/* Comment to insert, or NULL to remove */} CommentStmt;/* ---------------------- *		Declare Cursor Statement * ---------------------- */#define CURSOR_OPT_BINARY		0x0001#define CURSOR_OPT_SCROLL		0x0002#define CURSOR_OPT_NO_SCROLL	0x0004#define CURSOR_OPT_INSENSITIVE	0x0008#define CURSOR_OPT_HOLD			0x0010typedef struct DeclareCursorStmt{	NodeTag		type;	char	   *portalname;		/* name of the portal (cursor) */	int			options;		/* bitmask of options (see above) */	Node	   *query;			/* the SELECT query */} DeclareCursorStmt;/* ---------------------- *		Close Portal Statement * ---------------------- */typedef struct ClosePortalStmt{	NodeTag		type;	char	   *portalname;		/* name of the portal (cursor) */} ClosePortalStmt;/* ---------------------- *		Fetch Statement (also Move) * ---------------------- */typedef enum FetchDirection{	/* for these, howMany is how many rows to fetch; FETCH_ALL means ALL */	FETCH_FORWARD,	FETCH_BACKWARD,	/* for these, howMany indicates a position; only one row is fetched */	FETCH_ABSOLUTE,	FETCH_RELATIVE} FetchDirection;#define FETCH_ALL	LONG_MAXtypedef struct FetchStmt{	NodeTag		type;	FetchDirection direction;	/* see above */	long		howMany;		/* number of rows, or position argument */	char	   *portalname;		/* name of portal (cursor) */	bool		ismove;			/* TRUE if MOVE */} FetchStmt;/* ---------------------- *		Create Index Statement * ---------------------- */typedef struct IndexStmt{	NodeTag		type;	char	   *idxname;		/* name of the index */	RangeVar   *relation;		/* relation to build index on */	char	   *accessMethod;	/* name of access method (eg. btree) */	List	   *indexParams;	/* a list of IndexElem */	Node	   *whereClause;	/* qualification (partial-index predicate) */

⌨️ 快捷键说明

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