parsenodes.h

来自「PostgreSQL 8.2中增加了很多企业用户所需要的功能和性能上的提高,其开」· C头文件 代码 · 共 1,961 行 · 第 1/5 页

H
1,961
字号
{	NodeTag		type;	SetOperation op;			/* type of set op */	bool		all;			/* ALL specified? */	Node	   *larg;			/* left child */	Node	   *rarg;			/* right child */	/* Eventually add fields for CORRESPONDING spec here */	/* Fields derived during parse analysis: */	List	   *colTypes;		/* OID list of output column type OIDs */	List	   *colTypmods;		/* integer list of output column typmods */} SetOperationStmt;/***************************************************************************** *		Other Statements (no optimizations required) * *		Some of them require a little bit of transformation (which is also *		done by transformStmt). The whole structure is then passed on to *		ProcessUtility (by-passing the optimization step) as the utilityStmt *		field in Query. *****************************************************************************//* * When a command can act on several kinds of objects with only one * parse structure required, use these constants to designate the * object type. */typedef enum ObjectType{	OBJECT_AGGREGATE,	OBJECT_CAST,	OBJECT_COLUMN,	OBJECT_CONSTRAINT,	OBJECT_CONVERSION,	OBJECT_DATABASE,	OBJECT_DOMAIN,	OBJECT_FUNCTION,	OBJECT_INDEX,	OBJECT_LANGUAGE,	OBJECT_LARGEOBJECT,	OBJECT_OPCLASS,	OBJECT_OPERATOR,	OBJECT_ROLE,	OBJECT_RULE,	OBJECT_SCHEMA,	OBJECT_SEQUENCE,	OBJECT_TABLE,	OBJECT_TABLESPACE,	OBJECT_TRIGGER,	OBJECT_TYPE,	OBJECT_VIEW} ObjectType;/* ---------------------- *		Create Schema Statement * * NOTE: the schemaElts list contains raw parsetrees for component statements * of the schema, such as CREATE TABLE, GRANT, etc.  These are analyzed and * executed after the schema itself is created. * ---------------------- */typedef struct CreateSchemaStmt{	NodeTag		type;	char	   *schemaname;		/* the name of the schema to create */	char	   *authid;			/* the owner of the created schema */	List	   *schemaElts;		/* schema components (list of parsenodes) */} CreateSchemaStmt;typedef enum DropBehavior{	DROP_RESTRICT,				/* drop fails if any dependent objects */	DROP_CASCADE				/* remove dependent objects too */} DropBehavior;/* ---------------------- *	Alter Table * ---------------------- */typedef struct AlterTableStmt{	NodeTag		type;	RangeVar   *relation;		/* table to work on */	List	   *cmds;			/* list of subcommands */	ObjectType	relkind;		/* type of object */} AlterTableStmt;typedef enum AlterTableType{	AT_AddColumn,				/* add column */	AT_ColumnDefault,			/* alter column default */	AT_DropNotNull,				/* alter column drop not null */	AT_SetNotNull,				/* alter column set not null */	AT_SetStatistics,			/* alter column statistics */	AT_SetStorage,				/* alter column storage */	AT_DropColumn,				/* drop column */	AT_DropColumnRecurse,		/* internal to commands/tablecmds.c */	AT_AddIndex,				/* add index */	AT_ReAddIndex,				/* internal to commands/tablecmds.c */	AT_AddConstraint,			/* add constraint */	AT_ProcessedConstraint,		/* pre-processed add constraint (local in								 * parser/analyze.c) */	AT_DropConstraint,			/* drop constraint */	AT_DropConstraintQuietly,	/* drop constraint, no error/warning (local in								 * commands/tablecmds.c) */	AT_AlterColumnType,			/* alter column type */	AT_ChangeOwner,				/* change owner */	AT_ClusterOn,				/* CLUSTER ON */	AT_DropCluster,				/* SET WITHOUT CLUSTER */	AT_DropOids,				/* SET WITHOUT OIDS */	AT_SetTableSpace,			/* SET TABLESPACE */	AT_SetRelOptions,			/* SET (...) -- AM specific parameters */	AT_ResetRelOptions,			/* RESET (...) -- AM specific parameters */	AT_EnableTrig,				/* ENABLE TRIGGER name */	AT_DisableTrig,				/* DISABLE TRIGGER name */	AT_EnableTrigAll,			/* ENABLE TRIGGER ALL */	AT_DisableTrigAll,			/* DISABLE TRIGGER ALL */	AT_EnableTrigUser,			/* ENABLE TRIGGER USER */	AT_DisableTrigUser,			/* DISABLE TRIGGER USER */	AT_AddInherit,				/* INHERIT parent */	AT_DropInherit				/* NO INHERIT parent */} AlterTableType;typedef struct AlterTableCmd	/* one subcommand of an ALTER TABLE */{	NodeTag		type;	AlterTableType subtype;		/* Type of table alteration to apply */	char	   *name;			/* column, constraint, or trigger to act on,								 * or new owner or tablespace */	Node	   *def;			/* definition of new column, column type,								 * index, constraint, or parent table */	Node	   *transform;		/* transformation expr for ALTER TYPE */	DropBehavior behavior;		/* RESTRICT or CASCADE for DROP cases */} AlterTableCmd;/* ---------------------- *	Alter Domain * * The fields are used in different ways by the different variants of * this command. * ---------------------- */typedef struct AlterDomainStmt{	NodeTag		type;	char		subtype;		/*------------								 *	T = alter column default								 *	N = alter column drop not null								 *	O = alter column set not null								 *	C = add constraint								 *	X = drop constraint								 *------------								 */	List	   *typename;		/* domain to work on */	char	   *name;			/* column or constraint name to act on */	Node	   *def;			/* definition of default or constraint */	DropBehavior behavior;		/* RESTRICT or CASCADE for DROP cases */} AlterDomainStmt;/* ---------------------- *		Grant|Revoke Statement * ---------------------- */typedef enum GrantObjectType{	ACL_OBJECT_RELATION,		/* table, view */	ACL_OBJECT_SEQUENCE,		/* sequence */	ACL_OBJECT_DATABASE,		/* database */	ACL_OBJECT_FUNCTION,		/* function */	ACL_OBJECT_LANGUAGE,		/* procedural language */	ACL_OBJECT_NAMESPACE,		/* namespace */	ACL_OBJECT_TABLESPACE		/* tablespace */} GrantObjectType;typedef struct GrantStmt{	NodeTag		type;	bool		is_grant;		/* true = GRANT, false = REVOKE */	GrantObjectType objtype;	/* kind of object being operated on */	List	   *objects;		/* list of RangeVar nodes, FuncWithArgs nodes,								 * or plain names (as Value strings) */	List	   *privileges;		/* list of privilege names (as Strings) */	/* privileges == NIL denotes "all privileges" */	List	   *grantees;		/* list of PrivGrantee nodes */	bool		grant_option;	/* grant or revoke grant option */	DropBehavior behavior;		/* drop behavior (for REVOKE) */} GrantStmt;typedef struct PrivGrantee{	NodeTag		type;	char	   *rolname;		/* if NULL then PUBLIC */} PrivGrantee;/* * Note: FuncWithArgs carries only the types of the input parameters of the * function.  So it is sufficient to identify an existing function, but it * is not enough info to define a function nor to call it. */typedef struct FuncWithArgs{	NodeTag		type;	List	   *funcname;		/* qualified name of function */	List	   *funcargs;		/* list of Typename nodes */} FuncWithArgs;/* This is only used internally in gram.y. */typedef struct PrivTarget{	NodeTag		type;	GrantObjectType objtype;	List	   *objs;} PrivTarget;/* ---------------------- *		Grant/Revoke Role Statement * * Note: the lists of roles are lists of names, as Value strings * ---------------------- */typedef struct GrantRoleStmt{	NodeTag		type;	List	   *granted_roles;	/* list of roles to be granted/revoked */	List	   *grantee_roles;	/* list of member roles to add/delete */	bool		is_grant;		/* true = GRANT, false = REVOKE */	bool		admin_opt;		/* with admin option */	char	   *grantor;		/* set grantor to other than current role */	DropBehavior behavior;		/* drop behavior (for REVOKE) */} GrantRoleStmt;/* ---------------------- *		Copy Statement * * We support "COPY relation FROM file", "COPY relation TO file", and * "COPY (query) TO file".	In any given CopyStmt, exactly one of "relation" * and "query" must be non-NULL.  Note: "query" is a SelectStmt before * parse analysis, and a Query afterwards. * ---------------------- */typedef struct CopyStmt{	NodeTag		type;	RangeVar   *relation;		/* the relation to copy */	Query	   *query;			/* the query to copy */	List	   *attlist;		/* List of column names (as Strings), or NIL								 * for all columns */	bool		is_from;		/* TO or FROM */	char	   *filename;		/* filename, or NULL for 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). * ---------------------- */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) */	List	   *options;		/* options from WITH clause */	OnCommitAction oncommit;	/* what do we do at COMMIT? */	char	   *tablespacename; /* table space to use, or NULL */} CreateStmt;/* ---------- * Definitions for plain (non-FOREIGN KEY) constraints in CreateStmt * * XXX probably these ought to be unified with FkConstraints at some point? * To this end we include CONSTR_FOREIGN in the ConstrType enum, even though * the parser does not generate it. * * 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_FOREIGN,	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) */	List	   *options;		/* options from WITH clause */	char	   *indexspace;		/* index tablespace for PKEY/UNIQUE								 * constraints; NULL for default */} 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 Table Space Statements * ---------------------- */typedef struct CreateTableSpaceStmt{	NodeTag		type;	char	   *tablespacename;	char	   *owner;	char	   *location;} CreateTableSpaceStmt;typedef struct DropTableSpaceStmt{	NodeTag		type;	char	   *tablespacename;	bool		missing_ok;		/* skip error if a missing? */} DropTableSpaceStmt;/* ---------------------- *		Create/Drop TRIGGER Statements * ---------------------- */

⌨️ 快捷键说明

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