1996-08-28 03:59:28 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01:00
|
|
|
* nodes.h
|
1997-09-07 07:04:48 +02:00
|
|
|
* Definitions for tagged nodes.
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
1999-11-23 21:07:06 +01:00
|
|
|
* $Id: nodes.h,v 1.56 1999/11/23 20:07:02 momjian Exp $
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef NODES_H
|
1997-09-07 07:04:48 +02:00
|
|
|
#define NODES_H
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 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 number of the node tags are not contiguous. We left holes
|
|
|
|
* here so that we can add more tags without changing the existing enum's.
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef enum NodeTag
|
|
|
|
{
|
|
|
|
T_Invalid = 0,
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
/*---------------------
|
|
|
|
* TAGS FOR PLAN NODES (plannodes.h)
|
|
|
|
*---------------------
|
|
|
|
*/
|
|
|
|
T_Plan = 10,
|
|
|
|
T_Result,
|
|
|
|
T_Append,
|
|
|
|
T_Scan,
|
|
|
|
T_SeqScan,
|
|
|
|
T_IndexScan,
|
|
|
|
T_Join,
|
|
|
|
T_NestLoop,
|
|
|
|
T_MergeJoin,
|
|
|
|
T_HashJoin,
|
1999-02-09 18:03:14 +01:00
|
|
|
T_Noname,
|
1997-09-07 07:04:48 +02:00
|
|
|
T_Material,
|
|
|
|
T_Sort,
|
|
|
|
T_Agg,
|
|
|
|
T_Unique,
|
|
|
|
T_Hash,
|
|
|
|
T_Choose,
|
|
|
|
T_Group,
|
1998-02-13 04:45:29 +01:00
|
|
|
T_SubPlan,
|
1999-11-23 21:07:06 +01:00
|
|
|
T_TidScan,
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
/*---------------------
|
|
|
|
* TAGS FOR PRIMITIVE NODES (primnodes.h)
|
|
|
|
*---------------------
|
|
|
|
*/
|
|
|
|
T_Resdom = 100,
|
|
|
|
T_Fjoin,
|
|
|
|
T_Expr,
|
|
|
|
T_Var,
|
|
|
|
T_Oper,
|
|
|
|
T_Const,
|
|
|
|
T_Param,
|
1999-01-24 01:28:37 +01:00
|
|
|
T_Aggref,
|
1998-01-17 05:53:46 +01:00
|
|
|
T_SubLink,
|
1997-09-07 07:04:48 +02:00
|
|
|
T_Func,
|
|
|
|
T_Array,
|
|
|
|
T_ArrayRef,
|
1999-08-16 04:17:58 +02:00
|
|
|
T_Iter,
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
/*---------------------
|
1999-08-16 04:17:58 +02:00
|
|
|
* TAGS FOR PLANNER NODES (relation.h)
|
1997-09-07 07:04:48 +02:00
|
|
|
*---------------------
|
|
|
|
*/
|
1998-07-18 06:22:52 +02:00
|
|
|
T_RelOptInfo = 200,
|
1997-09-07 07:04:48 +02:00
|
|
|
T_Path,
|
|
|
|
T_IndexPath,
|
1999-02-12 07:43:53 +01:00
|
|
|
T_NestPath,
|
1997-09-07 07:04:48 +02:00
|
|
|
T_MergePath,
|
|
|
|
T_HashPath,
|
1999-08-16 04:17:58 +02:00
|
|
|
T_PathKeyItem,
|
1999-02-03 21:15:53 +01:00
|
|
|
T_RestrictInfo,
|
1998-09-01 05:29:17 +02:00
|
|
|
T_JoinInfo,
|
1997-09-07 07:04:48 +02:00
|
|
|
T_Stream,
|
1999-11-23 21:07:06 +01:00
|
|
|
T_TidPath,
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
/*---------------------
|
|
|
|
* TAGS FOR EXECUTOR NODES (execnodes.h)
|
|
|
|
*---------------------
|
|
|
|
*/
|
|
|
|
T_IndexInfo = 300,
|
|
|
|
T_RelationInfo,
|
|
|
|
T_TupleCount,
|
|
|
|
T_TupleTableSlot,
|
|
|
|
T_ExprContext,
|
|
|
|
T_ProjectionInfo,
|
|
|
|
T_JunkFilter,
|
|
|
|
T_EState,
|
|
|
|
T_BaseNode,
|
|
|
|
T_CommonState,
|
|
|
|
T_ResultState,
|
|
|
|
T_AppendState,
|
|
|
|
T_CommonScanState,
|
|
|
|
T_ScanState,
|
|
|
|
T_IndexScanState,
|
|
|
|
T_JoinState,
|
|
|
|
T_NestLoopState,
|
|
|
|
T_MergeJoinState,
|
|
|
|
T_HashJoinState,
|
|
|
|
T_MaterialState,
|
|
|
|
T_AggState,
|
|
|
|
T_GroupState,
|
|
|
|
T_SortState,
|
|
|
|
T_UniqueState,
|
|
|
|
T_HashState,
|
1999-11-23 21:07:06 +01:00
|
|
|
T_TidScanState,
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
/*---------------------
|
|
|
|
* TAGS FOR MEMORY NODES (memnodes.h)
|
|
|
|
*---------------------
|
|
|
|
*/
|
|
|
|
T_MemoryContext = 400,
|
|
|
|
T_GlobalMemory,
|
|
|
|
T_PortalMemoryContext,
|
|
|
|
T_PortalVariableMemory,
|
|
|
|
T_PortalHeapMemory,
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
/*---------------------
|
|
|
|
* TAGS FOR VALUE NODES (pg_list.h)
|
|
|
|
*---------------------
|
|
|
|
*/
|
|
|
|
T_Value = 500,
|
|
|
|
T_List,
|
|
|
|
T_Integer,
|
|
|
|
T_Float,
|
|
|
|
T_String,
|
|
|
|
T_Null,
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
/*---------------------
|
|
|
|
* TAGS FOR PARSE TREE NODES (parsenode.h)
|
|
|
|
*---------------------
|
|
|
|
*/
|
|
|
|
T_Query = 600,
|
1998-01-09 22:13:43 +01:00
|
|
|
T_InsertStmt,
|
1997-09-07 07:04:48 +02:00
|
|
|
T_DeleteStmt,
|
1998-01-09 22:13:43 +01:00
|
|
|
T_UpdateStmt,
|
|
|
|
T_SelectStmt,
|
1997-09-07 07:04:48 +02:00
|
|
|
T_AddAttrStmt,
|
|
|
|
T_AggregateStmt,
|
|
|
|
T_ChangeACLStmt,
|
|
|
|
T_ClosePortalStmt,
|
|
|
|
T_ClusterStmt,
|
|
|
|
T_CopyStmt,
|
|
|
|
T_CreateStmt,
|
|
|
|
T_VersionStmt,
|
|
|
|
T_DefineStmt,
|
|
|
|
T_DestroyStmt,
|
1999-09-23 19:03:39 +02:00
|
|
|
T_TruncateStmt,
|
This patch implements ORACLE's COMMENT SQL command.
>From the ORACLE 7 SQL Language Reference Manual:
-----------------------------------------------------
COMMENT
Purpose:
To add a comment about a table, view, snapshot, or
column into the data dictionary.
Prerequisites:
The table, view, or snapshot must be in your own
schema
or you must have COMMENT ANY TABLE system privilege.
Syntax:
COMMENT ON [ TABLE table ] |
[ COLUMN table.column] IS 'text'
You can effectively drop a comment from the database
by setting it to the empty string ''.
-----------------------------------------------------
Example:
COMMENT ON TABLE workorders IS
'Maintains base records for workorder information';
COMMENT ON COLUMN workorders.hours IS
'Number of hours the engineer worked on the task';
to drop a comment:
COMMENT ON COLUMN workorders.hours IS '';
The current patch will simply perform the insert into
pg_description, as per the TODO. And, of course, when
the table is dropped, any comments relating to it
or any of its attributes are also dropped. I haven't
looked at the ODBC source yet, but I do know from
an ODBC client standpoint that the standard does
support the notion of table and column comments.
Hopefully the ODBC driver is already fetching these
values from pg_description, but if not, it should be
trivial.
Hope this makes the grade,
Mike Mascari
(mascarim@yahoo.com)
1999-10-15 03:49:49 +02:00
|
|
|
T_CommentStmt,
|
1997-09-07 07:04:48 +02:00
|
|
|
T_ExtendStmt,
|
|
|
|
T_FetchStmt,
|
|
|
|
T_IndexStmt,
|
|
|
|
T_ProcedureStmt,
|
|
|
|
T_RemoveAggrStmt,
|
|
|
|
T_RemoveFuncStmt,
|
|
|
|
T_RemoveOperStmt,
|
|
|
|
T_RemoveStmt,
|
|
|
|
T_RenameStmt,
|
|
|
|
T_RuleStmt,
|
|
|
|
T_NotifyStmt,
|
|
|
|
T_ListenStmt,
|
1998-08-25 23:37:08 +02:00
|
|
|
T_UnlistenStmt,
|
1997-09-07 07:04:48 +02:00
|
|
|
T_TransactionStmt,
|
|
|
|
T_ViewStmt,
|
|
|
|
T_LoadStmt,
|
|
|
|
T_CreatedbStmt,
|
|
|
|
T_DestroydbStmt,
|
|
|
|
T_VacuumStmt,
|
|
|
|
T_ExplainStmt,
|
|
|
|
T_CreateSeqStmt,
|
|
|
|
T_VariableSetStmt,
|
|
|
|
T_VariableShowStmt,
|
|
|
|
T_VariableResetStmt,
|
|
|
|
T_CreateTrigStmt,
|
|
|
|
T_DropTrigStmt,
|
1997-10-28 16:11:45 +01:00
|
|
|
T_CreatePLangStmt,
|
|
|
|
T_DropPLangStmt,
|
1997-12-04 01:28:15 +01:00
|
|
|
T_CreateUserStmt,
|
|
|
|
T_AlterUserStmt,
|
|
|
|
T_DropUserStmt,
|
1998-12-18 10:10:39 +01:00
|
|
|
T_LockStmt,
|
1999-09-29 18:06:40 +02:00
|
|
|
T_ConstraintsSetStmt,
|
1997-09-07 07:04:48 +02:00
|
|
|
|
|
|
|
T_A_Expr = 700,
|
|
|
|
T_Attr,
|
|
|
|
T_A_Const,
|
|
|
|
T_ParamNo,
|
|
|
|
T_Ident,
|
|
|
|
T_FuncCall,
|
|
|
|
T_A_Indices,
|
|
|
|
T_ResTarget,
|
1999-10-02 23:33:33 +02:00
|
|
|
T_ParamString, /* not used anymore */
|
1997-09-07 07:04:48 +02:00
|
|
|
T_RelExpr,
|
|
|
|
T_SortGroupBy,
|
|
|
|
T_RangeVar,
|
|
|
|
T_TypeName,
|
|
|
|
T_IndexElem,
|
|
|
|
T_ColumnDef,
|
1997-12-05 00:43:59 +01:00
|
|
|
T_Constraint,
|
1997-09-07 07:04:48 +02:00
|
|
|
T_DefElem,
|
|
|
|
T_TargetEntry,
|
|
|
|
T_RangeTblEntry,
|
|
|
|
T_SortClause,
|
|
|
|
T_GroupClause,
|
1998-08-05 06:49:19 +02:00
|
|
|
T_SubSelect,
|
1999-02-23 08:55:24 +01:00
|
|
|
T_JoinExpr,
|
1998-12-04 16:34:49 +01:00
|
|
|
T_CaseExpr,
|
1999-01-21 17:08:55 +01:00
|
|
|
T_CaseWhen,
|
|
|
|
T_RowMark
|
1997-09-08 23:56:23 +02:00
|
|
|
} NodeTag;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/*
|
1998-12-04 16:34:49 +01:00
|
|
|
* The first field of a node of any type is guaranteed to be the NodeTag.
|
1996-08-28 03:59:28 +02:00
|
|
|
* 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.
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct Node
|
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
NodeTag type;
|
1997-09-08 23:56:23 +02:00
|
|
|
} Node;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1999-08-16 04:17:58 +02:00
|
|
|
#define nodeTag(nodeptr) (((Node*)(nodeptr))->type)
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1999-08-16 04:17:58 +02:00
|
|
|
#define makeNode(_type_) ((_type_ *) newNode(sizeof(_type_),T_##_type_))
|
|
|
|
#define NodeSetTag(nodeptr,t) (((Node*)(nodeptr))->type = (t))
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1999-08-16 04:17:58 +02:00
|
|
|
#define IsA(nodeptr,_type_) (nodeTag(nodeptr) == T_##_type_)
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* ----------------------------------------------------------------
|
1999-08-16 04:17:58 +02:00
|
|
|
* IsA functions (no inheritance any more)
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#define IsA_JoinPath(jp) \
|
1999-08-16 04:17:58 +02:00
|
|
|
(IsA(jp, NestPath) || IsA(jp, MergePath) || IsA(jp, HashPath))
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1999-08-16 04:17:58 +02:00
|
|
|
#define IsA_Join(jp) \
|
|
|
|
(IsA(jp, Join) || IsA(jp, NestLoop) || \
|
|
|
|
IsA(jp, MergeJoin) || IsA(jp, HashJoin))
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1999-02-09 18:03:14 +01:00
|
|
|
#define IsA_Noname(t) \
|
1999-08-16 04:17:58 +02:00
|
|
|
(IsA(t, Noname) || IsA(t, Material) || IsA(t, Sort) || \
|
|
|
|
IsA(t, Unique))
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* ----------------------------------------------------------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* extern declarations follow
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* nodes/nodes.c
|
|
|
|
*/
|
1997-09-08 04:41:22 +02:00
|
|
|
extern Node *newNode(Size size, NodeTag tag);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1999-08-16 04:17:58 +02:00
|
|
|
/*
|
|
|
|
* nodes/{outfuncs.c,print.c}
|
|
|
|
*/
|
1997-09-08 04:41:22 +02:00
|
|
|
extern char *nodeToString(void *obj);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* nodes/{readfuncs.c,read.c}
|
|
|
|
*/
|
1997-09-08 04:41:22 +02:00
|
|
|
extern void *stringToNode(char *str);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* nodes/copyfuncs.c
|
|
|
|
*/
|
1997-09-08 04:41:22 +02:00
|
|
|
extern void *copyObject(void *obj);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* nodes/equalfuncs.c
|
|
|
|
*/
|
1997-09-08 04:41:22 +02:00
|
|
|
extern bool equal(void *a, void *b);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* I don't know why this is here. Most likely a hack..
|
|
|
|
* -cim 6/3/90
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
1997-09-08 04:41:22 +02:00
|
|
|
typedef float Cost;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* CmdType -
|
1997-09-07 07:04:48 +02:00
|
|
|
* enums for type of operation to aid debugging
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
* ??? could have put this in parsenodes.h but many files not in the
|
1997-09-07 07:04:48 +02:00
|
|
|
* optimizer also need this...
|
1996-08-28 03:59:28 +02:00
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef enum CmdType
|
|
|
|
{
|
|
|
|
CMD_UNKNOWN,
|
|
|
|
CMD_SELECT, /* select stmt (formerly retrieve) */
|
|
|
|
CMD_UPDATE, /* update stmt (formerly replace) */
|
|
|
|
CMD_INSERT, /* insert stmt (formerly append) */
|
|
|
|
CMD_DELETE,
|
1998-09-01 06:40:42 +02:00
|
|
|
CMD_UTILITY, /* cmds like create, destroy, copy,
|
1997-09-07 07:04:48 +02:00
|
|
|
* vacuum, etc. */
|
1998-09-01 06:40:42 +02:00
|
|
|
CMD_NOTHING /* dummy command for instead nothing rules
|
|
|
|
* with qual */
|
1997-09-08 23:56:23 +02:00
|
|
|
} CmdType;
|
1997-09-07 07:04:48 +02:00
|
|
|
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1998-09-01 06:40:42 +02:00
|
|
|
#endif /* NODES_H */
|