📄 parsenodes.h
字号:
/*------------------------------------------------------------------------- * * parsenodes.h * definitions for parse tree nodes * * * Copyright (c) 1994, Regents of the University of California * * $Id: parsenodes.h,v 1.74 1999/05/25 22:42:57 momjian Exp $ * *------------------------------------------------------------------------- */#ifndef PARSENODES_H#define PARSENODES_H#include <nodes/primnodes.h>/***************************************************************************** * Query Tree *****************************************************************************//* * Query - * all statments are turned into a Query tree (via transformStmt) * for further processing by the optimizer * utility statements (i.e. non-optimizable statements) * have the *utilityStmt field set. * * we need the isPortal flag because portal names can be null too; can * get rid of it if we support CURSOR as a commandType. * */typedef struct Query{ NodeTag type; CmdType commandType; /* select|insert|update|delete|utility */ Node *utilityStmt; /* non-null if this is a non-optimizable * statement */ int resultRelation; /* target relation (index to rtable) */ char *into; /* portal (cursor) name */ bool isPortal; /* is this a retrieve into portal? */ bool isBinary; /* binary portal? */ bool isTemp; /* is 'into' a temp table? */ bool unionall; /* union without unique sort */ bool hasAggs; /* has aggregates in target list */ bool hasSubLinks; /* has subquery SubLink */ char *uniqueFlag; /* NULL, '*', or Unique attribute name */ List *sortClause; /* a list of SortClause's */ List *rtable; /* list of range table entries */ List *targetList; /* target list (of TargetEntry) */ Node *qual; /* qualifications */ List *rowMark; /* list of RowMark entries */ List *groupClause; /* list of columns to specified in GROUP * BY */ Node *havingQual; /* qualification of each group */ /***S*I***/ List *intersectClause; List *unionClause; /* unions are linked under the previous * query */ Node *limitOffset; /* # of result tuples to skip */ Node *limitCount; /* # of result tuples to return */ /* internal to planner */ List *base_rel_list; /* base relation list */ List *join_rel_list; /* list of relation involved in joins */} Query;/***************************************************************************** * Other Statements (no optimizations required) * * Some of them require a little bit of transformation (which is also * done by transformStmt). The whole structure is then passed on to * ProcessUtility (by-passing the optimization step) as the utilityStmt * field in Query. *****************************************************************************//* ---------------------- * Add Column Statement * ---------------------- */typedef struct AddAttrStmt{ NodeTag type; char *relname; /* the relation to add attr */ bool inh; /* add recursively to children? */ Node *colDef; /* the attribute definition */} AddAttrStmt;/* ---------------------- * Change ACL Statement * ---------------------- */typedef struct ChangeACLStmt{ NodeTag type; struct AclItem *aclitem; unsigned modechg; List *relNames;} ChangeACLStmt;/* ---------------------- * Close Portal Statement * ---------------------- */typedef struct ClosePortalStmt{ NodeTag type; char *portalname; /* name of the portal (cursor) */} ClosePortalStmt;/* ---------------------- * Copy Statement * ---------------------- */typedef struct CopyStmt{ NodeTag type; bool binary; /* is a binary copy? */ char *relname; /* the relation to copy */ bool oids; /* copy oid's? */ int direction; /* TO or FROM */ char *filename; /* if NULL, use stdin/stdout */ char *delimiter; /* delimiter character, \t by default */} CopyStmt;/* ---------------------- * Create Table Statement * ---------------------- */typedef struct CreateStmt{ NodeTag type; bool istemp; /* is this a temp table? */ char *relname; /* the relation to create */ List *tableElts; /* column definitions list of Column */ List *inhRelnames; /* relations to inherit from list of Value * (string) */ List *constraints; /* list of constraints (ConstaintDef) */} CreateStmt;typedef enum ConstrType /* type of constaints */{ CONSTR_NULL, CONSTR_NOTNULL, CONSTR_DEFAULT, CONSTR_CHECK, CONSTR_PRIMARY, CONSTR_UNIQUE} ConstrType;typedef struct Constraint{ NodeTag type; ConstrType contype; char *name; /* name */ void *def; /* definition */ void *keys; /* list of primary keys */} Constraint;/* ---------------------- * Create/Drop TRIGGER Statements * ---------------------- */typedef struct CreateTrigStmt{ NodeTag type; char *trigname; /* TRIGGER' name */ char *relname; /* triggered relation */ char *funcname; /* function to call (or NULL) */ List *args; /* list of (T_String) Values or NULL */ bool before; /* BEFORE/AFTER */ bool row; /* ROW/STATEMENT */ char actions[4]; /* Insert, Update, Delete */ char *lang; /* NULL (which means Clanguage) */ char *text; /* AS 'text' */ List *attr; /* UPDATE OF a, b,... (NI) or NULL */ char *when; /* WHEN 'a > 10 ...' (NI) or NULL */} CreateTrigStmt;typedef struct DropTrigStmt{ NodeTag type; char *trigname; /* TRIGGER' name */ char *relname; /* triggered relation */} DropTrigStmt;/* ---------------------- * Create/Drop PROCEDURAL LANGUAGE Statement * ---------------------- */typedef struct CreatePLangStmt{ NodeTag type; char *plname; /* PL name */ char *plhandler; /* PL call handler function */ char *plcompiler; /* lancompiler text */ bool pltrusted; /* PL is trusted */} CreatePLangStmt;typedef struct DropPLangStmt{ NodeTag type; char *plname; /* PL name */} DropPLangStmt;/* ---------------------- * Create/Alter/Drop User Statements * ---------------------- */typedef struct CreateUserStmt{ NodeTag type; char *user; /* PostgreSQL user login */ char *password; /* PostgreSQL user password */ bool *createdb; /* Can the user create databases? */ bool *createuser; /* Can this user create users? */ List *groupElts; /* The groups the user is a member of */ char *validUntil; /* The time the login is valid until */} CreateUserStmt;typedef CreateUserStmt AlterUserStmt;typedef struct DropUserStmt{ NodeTag type; char *user; /* PostgreSQL user login */} DropUserStmt;/* ---------------------- * Create SEQUENCE Statement * ---------------------- */typedef struct CreateSeqStmt{ NodeTag type; char *seqname; /* the relation to create */ List *options;} CreateSeqStmt;/* ---------------------- * Create Version Statement * ---------------------- */typedef struct VersionStmt{ NodeTag type; char *relname; /* the new relation */ int direction; /* FORWARD | BACKWARD */ char *fromRelname; /* relation to create a version */ char *date; /* date of the snapshot */} VersionStmt;/* ---------------------- * Create {Operator|Type|Aggregate} Statement * ---------------------- */typedef struct DefineStmt{ NodeTag type; int defType; /* OPERATOR|P_TYPE|AGGREGATE */ char *defname; List *definition; /* a list of DefElem */} DefineStmt;/* ---------------------- * Drop Table Statement * ---------------------- */typedef struct DestroyStmt{ NodeTag type; List *relNames; /* relations to be dropped */ bool sequence;} DestroyStmt;/* ---------------------- * Extend Index Statement * ---------------------- */typedef struct ExtendStmt{ NodeTag type; char *idxname; /* name of the index */ Node *whereClause; /* qualifications */ List *rangetable; /* range table, filled in by * transformStmt() */} ExtendStmt;/* ---------------------- * Begin Recipe Statement * ---------------------- */typedef struct RecipeStmt{ NodeTag type; char *recipeName; /* name of the recipe */} RecipeStmt;/* ---------------------- * Fetch Statement * ---------------------- */typedef struct FetchStmt{ NodeTag type; int direction; /* FORWARD or BACKWARD */ int howMany; /* amount to fetch ("ALL" --> 0) */ char *portalname; /* name of portal (cursor) */ bool ismove; /* TRUE if MOVE */} FetchStmt;/* ---------------------- * Create Index Statement * ---------------------- */typedef struct IndexStmt{ NodeTag type; char *idxname; /* name of the index */ char *relname; /* name of relation to index on */ char *accessMethod; /* name of acess methood (eg. btree) */ List *indexParams; /* a list of IndexElem */ List *withClause; /* a list of ParamString */ Node *whereClause; /* qualifications */ List *rangetable; /* range table, filled in by * transformStmt() */ bool *lossy; /* is index lossy? */ bool unique; /* is index unique? */ bool primary; /* is index on primary key? */} IndexStmt;/* ---------------------- * Create Function Statement * ---------------------- */typedef struct ProcedureStmt{ NodeTag type; char *funcname; /* name of function to create */ List *defArgs; /* list of definitions a list of strings * (as Value *) */ Node *returnType; /* the return type (as a string or a * TypeName (ie.setof) */ List *withClause; /* a list of ParamString */ char *as; /* the SQL statement or filename */ char *language; /* C or SQL */} ProcedureStmt;/* ---------------------- * Drop Aggregate Statement * ---------------------- */typedef struct RemoveAggrStmt{ NodeTag type; char *aggname; /* aggregate to drop */ char *aggtype; /* for this type */} RemoveAggrStmt;/* ---------------------- * Drop Function Statement * ---------------------- */typedef struct RemoveFuncStmt{ NodeTag type; char *funcname; /* function to drop */ List *args; /* types of the arguments */} RemoveFuncStmt;/* ---------------------- * Drop Operator Statement * ---------------------- */typedef struct RemoveOperStmt{ NodeTag type; char *opname; /* operator to drop */ List *args; /* types of the arguments */} RemoveOperStmt;/* ---------------------- * Drop {Type|Index|Rule|View} Statement * ---------------------- */typedef struct RemoveStmt{ NodeTag type; int removeType; /* P_TYPE|INDEX|RULE|VIEW */ char *name; /* name to drop */} RemoveStmt;/* ---------------------- * Alter Table Statement * ---------------------- */typedef struct RenameStmt{ NodeTag type; char *relname; /* relation to be altered */ bool inh; /* recursively alter children? */ char *column; /* if NULL, rename the relation name to * the new name. Otherwise, rename this * column name. */ char *newname; /* the new name */} RenameStmt;/* ---------------------- * Create Rule Statement * ---------------------- */typedef struct RuleStmt{ NodeTag type; char *rulename; /* name of the rule */ Node *whereClause; /* qualifications */ CmdType event; /* RETRIEVE */ struct Attr *object; /* object affected */ bool instead; /* is a 'do instead'? */ List *actions; /* the action statements */} RuleStmt;/* ---------------------- * Notify Statement * ---------------------- */typedef struct NotifyStmt{ NodeTag type; char *relname; /* relation to notify */} NotifyStmt;/* ---------------------- * Listen Statement * ---------------------- */typedef struct ListenStmt{ NodeTag type; char *relname; /* relation to listen on */} ListenStmt;/* ---------------------- * Unlisten Statement * ---------------------- */typedef struct UnlistenStmt{ NodeTag type; char *relname; /* relation to unlisten on */} UnlistenStmt;/* ---------------------- * {Begin|Abort|End} Transaction Statement * ---------------------- */typedef struct TransactionStmt{ NodeTag type; int command; /* BEGIN|END|ABORT */} TransactionStmt;/* ---------------------- * Create View Statement * ---------------------- */typedef struct ViewStmt{ NodeTag type; char *viewname; /* name of the view */ Query *query; /* the SQL statement */} ViewStmt;/* ---------------------- * Load Statement * ---------------------- */typedef struct LoadStmt{ NodeTag type;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -