LCOV - code coverage report
Current view: top level - src/include/nodes - nodes.h (source / functions) Hit Total Coverage
Test: PostgreSQL Lines: 3 3 100.0 %
Date: 2017-09-29 15:12:54 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*-------------------------------------------------------------------------
       2             :  *
       3             :  * nodes.h
       4             :  *    Definitions for tagged nodes.
       5             :  *
       6             :  *
       7             :  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
       8             :  * Portions Copyright (c) 1994, Regents of the University of California
       9             :  *
      10             :  * src/include/nodes/nodes.h
      11             :  *
      12             :  *-------------------------------------------------------------------------
      13             :  */
      14             : #ifndef NODES_H
      15             : #define NODES_H
      16             : 
      17             : /*
      18             :  * The first field of every node is NodeTag. Each node created (with makeNode)
      19             :  * will have one of the following tags as the value of its first field.
      20             :  *
      21             :  * Note that inserting or deleting node types changes the numbers of other
      22             :  * node types later in the list.  This is no problem during development, since
      23             :  * the node numbers are never stored on disk.  But don't do it in a released
      24             :  * branch, because that would represent an ABI break for extensions.
      25             :  */
      26             : typedef enum NodeTag
      27             : {
      28             :     T_Invalid = 0,
      29             : 
      30             :     /*
      31             :      * TAGS FOR EXECUTOR NODES (execnodes.h)
      32             :      */
      33             :     T_IndexInfo,
      34             :     T_ExprContext,
      35             :     T_ProjectionInfo,
      36             :     T_JunkFilter,
      37             :     T_ResultRelInfo,
      38             :     T_EState,
      39             :     T_TupleTableSlot,
      40             : 
      41             :     /*
      42             :      * TAGS FOR PLAN NODES (plannodes.h)
      43             :      */
      44             :     T_Plan,
      45             :     T_Result,
      46             :     T_ProjectSet,
      47             :     T_ModifyTable,
      48             :     T_Append,
      49             :     T_MergeAppend,
      50             :     T_RecursiveUnion,
      51             :     T_BitmapAnd,
      52             :     T_BitmapOr,
      53             :     T_Scan,
      54             :     T_SeqScan,
      55             :     T_SampleScan,
      56             :     T_IndexScan,
      57             :     T_IndexOnlyScan,
      58             :     T_BitmapIndexScan,
      59             :     T_BitmapHeapScan,
      60             :     T_TidScan,
      61             :     T_SubqueryScan,
      62             :     T_FunctionScan,
      63             :     T_ValuesScan,
      64             :     T_TableFuncScan,
      65             :     T_CteScan,
      66             :     T_NamedTuplestoreScan,
      67             :     T_WorkTableScan,
      68             :     T_ForeignScan,
      69             :     T_CustomScan,
      70             :     T_Join,
      71             :     T_NestLoop,
      72             :     T_MergeJoin,
      73             :     T_HashJoin,
      74             :     T_Material,
      75             :     T_Sort,
      76             :     T_Group,
      77             :     T_Agg,
      78             :     T_WindowAgg,
      79             :     T_Unique,
      80             :     T_Gather,
      81             :     T_GatherMerge,
      82             :     T_Hash,
      83             :     T_SetOp,
      84             :     T_LockRows,
      85             :     T_Limit,
      86             :     /* these aren't subclasses of Plan: */
      87             :     T_NestLoopParam,
      88             :     T_PlanRowMark,
      89             :     T_PlanInvalItem,
      90             : 
      91             :     /*
      92             :      * TAGS FOR PLAN STATE NODES (execnodes.h)
      93             :      *
      94             :      * These should correspond one-to-one with Plan node types.
      95             :      */
      96             :     T_PlanState,
      97             :     T_ResultState,
      98             :     T_ProjectSetState,
      99             :     T_ModifyTableState,
     100             :     T_AppendState,
     101             :     T_MergeAppendState,
     102             :     T_RecursiveUnionState,
     103             :     T_BitmapAndState,
     104             :     T_BitmapOrState,
     105             :     T_ScanState,
     106             :     T_SeqScanState,
     107             :     T_SampleScanState,
     108             :     T_IndexScanState,
     109             :     T_IndexOnlyScanState,
     110             :     T_BitmapIndexScanState,
     111             :     T_BitmapHeapScanState,
     112             :     T_TidScanState,
     113             :     T_SubqueryScanState,
     114             :     T_FunctionScanState,
     115             :     T_TableFuncScanState,
     116             :     T_ValuesScanState,
     117             :     T_CteScanState,
     118             :     T_NamedTuplestoreScanState,
     119             :     T_WorkTableScanState,
     120             :     T_ForeignScanState,
     121             :     T_CustomScanState,
     122             :     T_JoinState,
     123             :     T_NestLoopState,
     124             :     T_MergeJoinState,
     125             :     T_HashJoinState,
     126             :     T_MaterialState,
     127             :     T_SortState,
     128             :     T_GroupState,
     129             :     T_AggState,
     130             :     T_WindowAggState,
     131             :     T_UniqueState,
     132             :     T_GatherState,
     133             :     T_GatherMergeState,
     134             :     T_HashState,
     135             :     T_SetOpState,
     136             :     T_LockRowsState,
     137             :     T_LimitState,
     138             : 
     139             :     /*
     140             :      * TAGS FOR PRIMITIVE NODES (primnodes.h)
     141             :      */
     142             :     T_Alias,
     143             :     T_RangeVar,
     144             :     T_TableFunc,
     145             :     T_Expr,
     146             :     T_Var,
     147             :     T_Const,
     148             :     T_Param,
     149             :     T_Aggref,
     150             :     T_GroupingFunc,
     151             :     T_WindowFunc,
     152             :     T_ArrayRef,
     153             :     T_FuncExpr,
     154             :     T_NamedArgExpr,
     155             :     T_OpExpr,
     156             :     T_DistinctExpr,
     157             :     T_NullIfExpr,
     158             :     T_ScalarArrayOpExpr,
     159             :     T_BoolExpr,
     160             :     T_SubLink,
     161             :     T_SubPlan,
     162             :     T_AlternativeSubPlan,
     163             :     T_FieldSelect,
     164             :     T_FieldStore,
     165             :     T_RelabelType,
     166             :     T_CoerceViaIO,
     167             :     T_ArrayCoerceExpr,
     168             :     T_ConvertRowtypeExpr,
     169             :     T_CollateExpr,
     170             :     T_CaseExpr,
     171             :     T_CaseWhen,
     172             :     T_CaseTestExpr,
     173             :     T_ArrayExpr,
     174             :     T_RowExpr,
     175             :     T_RowCompareExpr,
     176             :     T_CoalesceExpr,
     177             :     T_MinMaxExpr,
     178             :     T_SQLValueFunction,
     179             :     T_XmlExpr,
     180             :     T_NullTest,
     181             :     T_BooleanTest,
     182             :     T_CoerceToDomain,
     183             :     T_CoerceToDomainValue,
     184             :     T_SetToDefault,
     185             :     T_CurrentOfExpr,
     186             :     T_NextValueExpr,
     187             :     T_InferenceElem,
     188             :     T_TargetEntry,
     189             :     T_RangeTblRef,
     190             :     T_JoinExpr,
     191             :     T_FromExpr,
     192             :     T_OnConflictExpr,
     193             :     T_IntoClause,
     194             : 
     195             :     /*
     196             :      * TAGS FOR EXPRESSION STATE NODES (execnodes.h)
     197             :      *
     198             :      * ExprState represents the evaluation state for a whole expression tree.
     199             :      * Most Expr-based plan nodes do not have a corresponding expression state
     200             :      * node, they're fully handled within execExpr* - but sometimes the state
     201             :      * needs to be shared with other parts of the executor, as for example
     202             :      * with AggrefExprState, which nodeAgg.c has to modify.
     203             :      */
     204             :     T_ExprState,
     205             :     T_AggrefExprState,
     206             :     T_WindowFuncExprState,
     207             :     T_SetExprState,
     208             :     T_SubPlanState,
     209             :     T_AlternativeSubPlanState,
     210             :     T_DomainConstraintState,
     211             : 
     212             :     /*
     213             :      * TAGS FOR PLANNER NODES (relation.h)
     214             :      */
     215             :     T_PlannerInfo,
     216             :     T_PlannerGlobal,
     217             :     T_RelOptInfo,
     218             :     T_IndexOptInfo,
     219             :     T_ForeignKeyOptInfo,
     220             :     T_ParamPathInfo,
     221             :     T_Path,
     222             :     T_IndexPath,
     223             :     T_BitmapHeapPath,
     224             :     T_BitmapAndPath,
     225             :     T_BitmapOrPath,
     226             :     T_TidPath,
     227             :     T_SubqueryScanPath,
     228             :     T_ForeignPath,
     229             :     T_CustomPath,
     230             :     T_NestPath,
     231             :     T_MergePath,
     232             :     T_HashPath,
     233             :     T_AppendPath,
     234             :     T_MergeAppendPath,
     235             :     T_ResultPath,
     236             :     T_MaterialPath,
     237             :     T_UniquePath,
     238             :     T_GatherPath,
     239             :     T_GatherMergePath,
     240             :     T_ProjectionPath,
     241             :     T_ProjectSetPath,
     242             :     T_SortPath,
     243             :     T_GroupPath,
     244             :     T_UpperUniquePath,
     245             :     T_AggPath,
     246             :     T_GroupingSetsPath,
     247             :     T_MinMaxAggPath,
     248             :     T_WindowAggPath,
     249             :     T_SetOpPath,
     250             :     T_RecursiveUnionPath,
     251             :     T_LockRowsPath,
     252             :     T_ModifyTablePath,
     253             :     T_LimitPath,
     254             :     /* these aren't subclasses of Path: */
     255             :     T_EquivalenceClass,
     256             :     T_EquivalenceMember,
     257             :     T_PathKey,
     258             :     T_PathTarget,
     259             :     T_RestrictInfo,
     260             :     T_PlaceHolderVar,
     261             :     T_SpecialJoinInfo,
     262             :     T_AppendRelInfo,
     263             :     T_PartitionedChildRelInfo,
     264             :     T_PlaceHolderInfo,
     265             :     T_MinMaxAggInfo,
     266             :     T_PlannerParamItem,
     267             :     T_RollupData,
     268             :     T_GroupingSetData,
     269             :     T_StatisticExtInfo,
     270             : 
     271             :     /*
     272             :      * TAGS FOR MEMORY NODES (memnodes.h)
     273             :      */
     274             :     T_MemoryContext,
     275             :     T_AllocSetContext,
     276             :     T_SlabContext,
     277             : 
     278             :     /*
     279             :      * TAGS FOR VALUE NODES (value.h)
     280             :      */
     281             :     T_Value,
     282             :     T_Integer,
     283             :     T_Float,
     284             :     T_String,
     285             :     T_BitString,
     286             :     T_Null,
     287             : 
     288             :     /*
     289             :      * TAGS FOR LIST NODES (pg_list.h)
     290             :      */
     291             :     T_List,
     292             :     T_IntList,
     293             :     T_OidList,
     294             : 
     295             :     /*
     296             :      * TAGS FOR EXTENSIBLE NODES (extensible.h)
     297             :      */
     298             :     T_ExtensibleNode,
     299             : 
     300             :     /*
     301             :      * TAGS FOR STATEMENT NODES (mostly in parsenodes.h)
     302             :      */
     303             :     T_RawStmt,
     304             :     T_Query,
     305             :     T_PlannedStmt,
     306             :     T_InsertStmt,
     307             :     T_DeleteStmt,
     308             :     T_UpdateStmt,
     309             :     T_SelectStmt,
     310             :     T_AlterTableStmt,
     311             :     T_AlterTableCmd,
     312             :     T_AlterDomainStmt,
     313             :     T_SetOperationStmt,
     314             :     T_GrantStmt,
     315             :     T_GrantRoleStmt,
     316             :     T_AlterDefaultPrivilegesStmt,
     317             :     T_ClosePortalStmt,
     318             :     T_ClusterStmt,
     319             :     T_CopyStmt,
     320             :     T_CreateStmt,
     321             :     T_DefineStmt,
     322             :     T_DropStmt,
     323             :     T_TruncateStmt,
     324             :     T_CommentStmt,
     325             :     T_FetchStmt,
     326             :     T_IndexStmt,
     327             :     T_CreateFunctionStmt,
     328             :     T_AlterFunctionStmt,
     329             :     T_DoStmt,
     330             :     T_RenameStmt,
     331             :     T_RuleStmt,
     332             :     T_NotifyStmt,
     333             :     T_ListenStmt,
     334             :     T_UnlistenStmt,
     335             :     T_TransactionStmt,
     336             :     T_ViewStmt,
     337             :     T_LoadStmt,
     338             :     T_CreateDomainStmt,
     339             :     T_CreatedbStmt,
     340             :     T_DropdbStmt,
     341             :     T_VacuumStmt,
     342             :     T_ExplainStmt,
     343             :     T_CreateTableAsStmt,
     344             :     T_CreateSeqStmt,
     345             :     T_AlterSeqStmt,
     346             :     T_VariableSetStmt,
     347             :     T_VariableShowStmt,
     348             :     T_DiscardStmt,
     349             :     T_CreateTrigStmt,
     350             :     T_CreatePLangStmt,
     351             :     T_CreateRoleStmt,
     352             :     T_AlterRoleStmt,
     353             :     T_DropRoleStmt,
     354             :     T_LockStmt,
     355             :     T_ConstraintsSetStmt,
     356             :     T_ReindexStmt,
     357             :     T_CheckPointStmt,
     358             :     T_CreateSchemaStmt,
     359             :     T_AlterDatabaseStmt,
     360             :     T_AlterDatabaseSetStmt,
     361             :     T_AlterRoleSetStmt,
     362             :     T_CreateConversionStmt,
     363             :     T_CreateCastStmt,
     364             :     T_CreateOpClassStmt,
     365             :     T_CreateOpFamilyStmt,
     366             :     T_AlterOpFamilyStmt,
     367             :     T_PrepareStmt,
     368             :     T_ExecuteStmt,
     369             :     T_DeallocateStmt,
     370             :     T_DeclareCursorStmt,
     371             :     T_CreateTableSpaceStmt,
     372             :     T_DropTableSpaceStmt,
     373             :     T_AlterObjectDependsStmt,
     374             :     T_AlterObjectSchemaStmt,
     375             :     T_AlterOwnerStmt,
     376             :     T_AlterOperatorStmt,
     377             :     T_DropOwnedStmt,
     378             :     T_ReassignOwnedStmt,
     379             :     T_CompositeTypeStmt,
     380             :     T_CreateEnumStmt,
     381             :     T_CreateRangeStmt,
     382             :     T_AlterEnumStmt,
     383             :     T_AlterTSDictionaryStmt,
     384             :     T_AlterTSConfigurationStmt,
     385             :     T_CreateFdwStmt,
     386             :     T_AlterFdwStmt,
     387             :     T_CreateForeignServerStmt,
     388             :     T_AlterForeignServerStmt,
     389             :     T_CreateUserMappingStmt,
     390             :     T_AlterUserMappingStmt,
     391             :     T_DropUserMappingStmt,
     392             :     T_AlterTableSpaceOptionsStmt,
     393             :     T_AlterTableMoveAllStmt,
     394             :     T_SecLabelStmt,
     395             :     T_CreateForeignTableStmt,
     396             :     T_ImportForeignSchemaStmt,
     397             :     T_CreateExtensionStmt,
     398             :     T_AlterExtensionStmt,
     399             :     T_AlterExtensionContentsStmt,
     400             :     T_CreateEventTrigStmt,
     401             :     T_AlterEventTrigStmt,
     402             :     T_RefreshMatViewStmt,
     403             :     T_ReplicaIdentityStmt,
     404             :     T_AlterSystemStmt,
     405             :     T_CreatePolicyStmt,
     406             :     T_AlterPolicyStmt,
     407             :     T_CreateTransformStmt,
     408             :     T_CreateAmStmt,
     409             :     T_CreatePublicationStmt,
     410             :     T_AlterPublicationStmt,
     411             :     T_CreateSubscriptionStmt,
     412             :     T_AlterSubscriptionStmt,
     413             :     T_DropSubscriptionStmt,
     414             :     T_CreateStatsStmt,
     415             :     T_AlterCollationStmt,
     416             : 
     417             :     /*
     418             :      * TAGS FOR PARSE TREE NODES (parsenodes.h)
     419             :      */
     420             :     T_A_Expr,
     421             :     T_ColumnRef,
     422             :     T_ParamRef,
     423             :     T_A_Const,
     424             :     T_FuncCall,
     425             :     T_A_Star,
     426             :     T_A_Indices,
     427             :     T_A_Indirection,
     428             :     T_A_ArrayExpr,
     429             :     T_ResTarget,
     430             :     T_MultiAssignRef,
     431             :     T_TypeCast,
     432             :     T_CollateClause,
     433             :     T_SortBy,
     434             :     T_WindowDef,
     435             :     T_RangeSubselect,
     436             :     T_RangeFunction,
     437             :     T_RangeTableSample,
     438             :     T_RangeTableFunc,
     439             :     T_RangeTableFuncCol,
     440             :     T_TypeName,
     441             :     T_ColumnDef,
     442             :     T_IndexElem,
     443             :     T_Constraint,
     444             :     T_DefElem,
     445             :     T_RangeTblEntry,
     446             :     T_RangeTblFunction,
     447             :     T_TableSampleClause,
     448             :     T_WithCheckOption,
     449             :     T_SortGroupClause,
     450             :     T_GroupingSet,
     451             :     T_WindowClause,
     452             :     T_ObjectWithArgs,
     453             :     T_AccessPriv,
     454             :     T_CreateOpClassItem,
     455             :     T_TableLikeClause,
     456             :     T_FunctionParameter,
     457             :     T_LockingClause,
     458             :     T_RowMarkClause,
     459             :     T_XmlSerialize,
     460             :     T_WithClause,
     461             :     T_InferClause,
     462             :     T_OnConflictClause,
     463             :     T_CommonTableExpr,
     464             :     T_RoleSpec,
     465             :     T_TriggerTransition,
     466             :     T_PartitionElem,
     467             :     T_PartitionSpec,
     468             :     T_PartitionBoundSpec,
     469             :     T_PartitionRangeDatum,
     470             :     T_PartitionCmd,
     471             : 
     472             :     /*
     473             :      * TAGS FOR REPLICATION GRAMMAR PARSE NODES (replnodes.h)
     474             :      */
     475             :     T_IdentifySystemCmd,
     476             :     T_BaseBackupCmd,
     477             :     T_CreateReplicationSlotCmd,
     478             :     T_DropReplicationSlotCmd,
     479             :     T_StartReplicationCmd,
     480             :     T_TimeLineHistoryCmd,
     481             :     T_SQLCmd,
     482             : 
     483             :     /*
     484             :      * TAGS FOR RANDOM OTHER STUFF
     485             :      *
     486             :      * These are objects that aren't part of parse/plan/execute node tree
     487             :      * structures, but we give them NodeTags anyway for identification
     488             :      * purposes (usually because they are involved in APIs where we want to
     489             :      * pass multiple object types through the same pointer).
     490             :      */
     491             :     T_TriggerData,              /* in commands/trigger.h */
     492             :     T_EventTriggerData,         /* in commands/event_trigger.h */
     493             :     T_ReturnSetInfo,            /* in nodes/execnodes.h */
     494             :     T_WindowObjectData,         /* private in nodeWindowAgg.c */
     495             :     T_TIDBitmap,                /* in nodes/tidbitmap.h */
     496             :     T_InlineCodeBlock,          /* in nodes/parsenodes.h */
     497             :     T_FdwRoutine,               /* in foreign/fdwapi.h */
     498             :     T_IndexAmRoutine,           /* in access/amapi.h */
     499             :     T_TsmRoutine,               /* in access/tsmapi.h */
     500             :     T_ForeignKeyCacheInfo       /* in utils/rel.h */
     501             : } NodeTag;
     502             : 
     503             : /*
     504             :  * The first field of a node of any type is guaranteed to be the NodeTag.
     505             :  * Hence the type of any node can be gotten by casting it to Node. Declaring
     506             :  * a variable to be of Node * (instead of void *) can also facilitate
     507             :  * debugging.
     508             :  */
     509             : typedef struct Node
     510             : {
     511             :     NodeTag     type;
     512             : } Node;
     513             : 
     514             : #define nodeTag(nodeptr)        (((const Node*)(nodeptr))->type)
     515             : 
     516             : /*
     517             :  * newNode -
     518             :  *    create a new node of the specified size and tag the node with the
     519             :  *    specified tag.
     520             :  *
     521             :  * !WARNING!: Avoid using newNode directly. You should be using the
     522             :  *    macro makeNode.  eg. to create a Query node, use makeNode(Query)
     523             :  *
     524             :  * Note: the size argument should always be a compile-time constant, so the
     525             :  * apparent risk of multiple evaluation doesn't matter in practice.
     526             :  */
     527             : #ifdef __GNUC__
     528             : 
     529             : /* With GCC, we can use a compound statement within an expression */
     530             : #define newNode(size, tag) \
     531             : ({  Node   *_result; \
     532             :     AssertMacro((size) >= sizeof(Node));     /* need the tag, at least */ \
     533             :     _result = (Node *) palloc0fast(size); \
     534             :     _result->type = (tag); \
     535             :     _result; \
     536             : })
     537             : #else
     538             : 
     539             : /*
     540             :  *  There is no way to dereference the palloc'ed pointer to assign the
     541             :  *  tag, and also return the pointer itself, so we need a holder variable.
     542             :  *  Fortunately, this macro isn't recursive so we just define
     543             :  *  a global variable for this purpose.
     544             :  */
     545             : extern PGDLLIMPORT Node *newNodeMacroHolder;
     546             : 
     547             : #define newNode(size, tag) \
     548             : ( \
     549             :     AssertMacro((size) >= sizeof(Node)),     /* need the tag, at least */ \
     550             :     newNodeMacroHolder = (Node *) palloc0fast(size), \
     551             :     newNodeMacroHolder->type = (tag), \
     552             :     newNodeMacroHolder \
     553             : )
     554             : #endif                          /* __GNUC__ */
     555             : 
     556             : 
     557             : #define makeNode(_type_)        ((_type_ *) newNode(sizeof(_type_),T_##_type_))
     558             : #define NodeSetTag(nodeptr,t)   (((Node*)(nodeptr))->type = (t))
     559             : 
     560             : #define IsA(nodeptr,_type_)     (nodeTag(nodeptr) == T_##_type_)
     561             : 
     562             : /*
     563             :  * castNode(type, ptr) casts ptr to "type *", and if assertions are enabled,
     564             :  * verifies that the node has the appropriate type (using its nodeTag()).
     565             :  *
     566             :  * Use an inline function when assertions are enabled, to avoid multiple
     567             :  * evaluations of the ptr argument (which could e.g. be a function call).
     568             :  */
     569             : #ifdef USE_ASSERT_CHECKING
     570             : static inline Node *
     571    21626271 : castNodeImpl(NodeTag type, void *ptr)
     572             : {
     573    21626271 :     Assert(ptr == NULL || nodeTag(ptr) == type);
     574    21626271 :     return (Node *) ptr;
     575             : }
     576             : #define castNode(_type_, nodeptr) ((_type_ *) castNodeImpl(T_##_type_, nodeptr))
     577             : #else
     578             : #define castNode(_type_, nodeptr) ((_type_ *) (nodeptr))
     579             : #endif                          /* USE_ASSERT_CHECKING */
     580             : 
     581             : 
     582             : /* ----------------------------------------------------------------
     583             :  *                    extern declarations follow
     584             :  * ----------------------------------------------------------------
     585             :  */
     586             : 
     587             : /*
     588             :  * nodes/{outfuncs.c,print.c}
     589             :  */
     590             : struct Bitmapset;               /* not to include bitmapset.h here */
     591             : struct StringInfoData;          /* not to include stringinfo.h here */
     592             : 
     593             : extern void outNode(struct StringInfoData *str, const void *obj);
     594             : extern void outToken(struct StringInfoData *str, const char *s);
     595             : extern void outBitmapset(struct StringInfoData *str,
     596             :              const struct Bitmapset *bms);
     597             : extern void outDatum(struct StringInfoData *str, uintptr_t value,
     598             :          int typlen, bool typbyval);
     599             : extern char *nodeToString(const void *obj);
     600             : extern char *bmsToString(const struct Bitmapset *bms);
     601             : 
     602             : /*
     603             :  * nodes/{readfuncs.c,read.c}
     604             :  */
     605             : extern void *stringToNode(char *str);
     606             : extern struct Bitmapset *readBitmapset(void);
     607             : extern uintptr_t readDatum(bool typbyval);
     608             : extern bool *readBoolCols(int numCols);
     609             : extern int *readIntCols(int numCols);
     610             : extern Oid *readOidCols(int numCols);
     611             : extern int16 *readAttrNumberCols(int numCols);
     612             : 
     613             : /*
     614             :  * nodes/copyfuncs.c
     615             :  */
     616             : extern void *copyObjectImpl(const void *obj);
     617             : 
     618             : /* cast result back to argument type, if supported by compiler */
     619             : #ifdef HAVE_TYPEOF
     620             : #define copyObject(obj) ((typeof(obj)) copyObjectImpl(obj))
     621             : #else
     622             : #define copyObject(obj) copyObjectImpl(obj)
     623             : #endif
     624             : 
     625             : /*
     626             :  * nodes/equalfuncs.c
     627             :  */
     628             : extern bool equal(const void *a, const void *b);
     629             : 
     630             : 
     631             : /*
     632             :  * Typedefs for identifying qualifier selectivities and plan costs as such.
     633             :  * These are just plain "double"s, but declaring a variable as Selectivity
     634             :  * or Cost makes the intent more obvious.
     635             :  *
     636             :  * These could have gone into plannodes.h or some such, but many files
     637             :  * depend on them...
     638             :  */
     639             : typedef double Selectivity;     /* fraction of tuples a qualifier will pass */
     640             : typedef double Cost;            /* execution cost (in page-access units) */
     641             : 
     642             : 
     643             : /*
     644             :  * CmdType -
     645             :  *    enums for type of operation represented by a Query or PlannedStmt
     646             :  *
     647             :  * This is needed in both parsenodes.h and plannodes.h, so put it here...
     648             :  */
     649             : typedef enum CmdType
     650             : {
     651             :     CMD_UNKNOWN,
     652             :     CMD_SELECT,                 /* select stmt */
     653             :     CMD_UPDATE,                 /* update stmt */
     654             :     CMD_INSERT,                 /* insert stmt */
     655             :     CMD_DELETE,
     656             :     CMD_UTILITY,                /* cmds like create, destroy, copy, vacuum,
     657             :                                  * etc. */
     658             :     CMD_NOTHING                 /* dummy command for instead nothing rules
     659             :                                  * with qual */
     660             : } CmdType;
     661             : 
     662             : 
     663             : /*
     664             :  * JoinType -
     665             :  *    enums for types of relation joins
     666             :  *
     667             :  * JoinType determines the exact semantics of joining two relations using
     668             :  * a matching qualification.  For example, it tells what to do with a tuple
     669             :  * that has no match in the other relation.
     670             :  *
     671             :  * This is needed in both parsenodes.h and plannodes.h, so put it here...
     672             :  */
     673             : typedef enum JoinType
     674             : {
     675             :     /*
     676             :      * The canonical kinds of joins according to the SQL JOIN syntax. Only
     677             :      * these codes can appear in parser output (e.g., JoinExpr nodes).
     678             :      */
     679             :     JOIN_INNER,                 /* matching tuple pairs only */
     680             :     JOIN_LEFT,                  /* pairs + unmatched LHS tuples */
     681             :     JOIN_FULL,                  /* pairs + unmatched LHS + unmatched RHS */
     682             :     JOIN_RIGHT,                 /* pairs + unmatched RHS tuples */
     683             : 
     684             :     /*
     685             :      * Semijoins and anti-semijoins (as defined in relational theory) do not
     686             :      * appear in the SQL JOIN syntax, but there are standard idioms for
     687             :      * representing them (e.g., using EXISTS).  The planner recognizes these
     688             :      * cases and converts them to joins.  So the planner and executor must
     689             :      * support these codes.  NOTE: in JOIN_SEMI output, it is unspecified
     690             :      * which matching RHS row is joined to.  In JOIN_ANTI output, the row is
     691             :      * guaranteed to be null-extended.
     692             :      */
     693             :     JOIN_SEMI,                  /* 1 copy of each LHS row that has match(es) */
     694             :     JOIN_ANTI,                  /* 1 copy of each LHS row that has no match */
     695             : 
     696             :     /*
     697             :      * These codes are used internally in the planner, but are not supported
     698             :      * by the executor (nor, indeed, by most of the planner).
     699             :      */
     700             :     JOIN_UNIQUE_OUTER,          /* LHS path must be made unique */
     701             :     JOIN_UNIQUE_INNER           /* RHS path must be made unique */
     702             : 
     703             :     /*
     704             :      * We might need additional join types someday.
     705             :      */
     706             : } JoinType;
     707             : 
     708             : /*
     709             :  * OUTER joins are those for which pushed-down quals must behave differently
     710             :  * from the join's own quals.  This is in fact everything except INNER and
     711             :  * SEMI joins.  However, this macro must also exclude the JOIN_UNIQUE symbols
     712             :  * since those are temporary proxies for what will eventually be an INNER
     713             :  * join.
     714             :  *
     715             :  * Note: semijoins are a hybrid case, but we choose to treat them as not
     716             :  * being outer joins.  This is okay principally because the SQL syntax makes
     717             :  * it impossible to have a pushed-down qual that refers to the inner relation
     718             :  * of a semijoin; so there is no strong need to distinguish join quals from
     719             :  * pushed-down quals.  This is convenient because for almost all purposes,
     720             :  * quals attached to a semijoin can be treated the same as innerjoin quals.
     721             :  */
     722             : #define IS_OUTER_JOIN(jointype) \
     723             :     (((1 << (jointype)) & \
     724             :       ((1 << JOIN_LEFT) | \
     725             :        (1 << JOIN_FULL) | \
     726             :        (1 << JOIN_RIGHT) | \
     727             :        (1 << JOIN_ANTI))) != 0)
     728             : 
     729             : /*
     730             :  * AggStrategy -
     731             :  *    overall execution strategies for Agg plan nodes
     732             :  *
     733             :  * This is needed in both plannodes.h and relation.h, so put it here...
     734             :  */
     735             : typedef enum AggStrategy
     736             : {
     737             :     AGG_PLAIN,                  /* simple agg across all input rows */
     738             :     AGG_SORTED,                 /* grouped agg, input must be sorted */
     739             :     AGG_HASHED,                 /* grouped agg, use internal hashtable */
     740             :     AGG_MIXED                   /* grouped agg, hash and sort both used */
     741             : } AggStrategy;
     742             : 
     743             : /*
     744             :  * AggSplit -
     745             :  *    splitting (partial aggregation) modes for Agg plan nodes
     746             :  *
     747             :  * This is needed in both plannodes.h and relation.h, so put it here...
     748             :  */
     749             : 
     750             : /* Primitive options supported by nodeAgg.c: */
     751             : #define AGGSPLITOP_COMBINE      0x01    /* substitute combinefn for transfn */
     752             : #define AGGSPLITOP_SKIPFINAL    0x02    /* skip finalfn, return state as-is */
     753             : #define AGGSPLITOP_SERIALIZE    0x04    /* apply serializefn to output */
     754             : #define AGGSPLITOP_DESERIALIZE  0x08    /* apply deserializefn to input */
     755             : 
     756             : /* Supported operating modes (i.e., useful combinations of these options): */
     757             : typedef enum AggSplit
     758             : {
     759             :     /* Basic, non-split aggregation: */
     760             :     AGGSPLIT_SIMPLE = 0,
     761             :     /* Initial phase of partial aggregation, with serialization: */
     762             :     AGGSPLIT_INITIAL_SERIAL = AGGSPLITOP_SKIPFINAL | AGGSPLITOP_SERIALIZE,
     763             :     /* Final phase of partial aggregation, with deserialization: */
     764             :     AGGSPLIT_FINAL_DESERIAL = AGGSPLITOP_COMBINE | AGGSPLITOP_DESERIALIZE
     765             : } AggSplit;
     766             : 
     767             : /* Test whether an AggSplit value selects each primitive option: */
     768             : #define DO_AGGSPLIT_COMBINE(as)     (((as) & AGGSPLITOP_COMBINE) != 0)
     769             : #define DO_AGGSPLIT_SKIPFINAL(as)   (((as) & AGGSPLITOP_SKIPFINAL) != 0)
     770             : #define DO_AGGSPLIT_SERIALIZE(as)   (((as) & AGGSPLITOP_SERIALIZE) != 0)
     771             : #define DO_AGGSPLIT_DESERIALIZE(as) (((as) & AGGSPLITOP_DESERIALIZE) != 0)
     772             : 
     773             : /*
     774             :  * SetOpCmd and SetOpStrategy -
     775             :  *    overall semantics and execution strategies for SetOp plan nodes
     776             :  *
     777             :  * This is needed in both plannodes.h and relation.h, so put it here...
     778             :  */
     779             : typedef enum SetOpCmd
     780             : {
     781             :     SETOPCMD_INTERSECT,
     782             :     SETOPCMD_INTERSECT_ALL,
     783             :     SETOPCMD_EXCEPT,
     784             :     SETOPCMD_EXCEPT_ALL
     785             : } SetOpCmd;
     786             : 
     787             : typedef enum SetOpStrategy
     788             : {
     789             :     SETOP_SORTED,               /* input must be sorted */
     790             :     SETOP_HASHED                /* use internal hashtable */
     791             : } SetOpStrategy;
     792             : 
     793             : /*
     794             :  * OnConflictAction -
     795             :  *    "ON CONFLICT" clause type of query
     796             :  *
     797             :  * This is needed in both parsenodes.h and plannodes.h, so put it here...
     798             :  */
     799             : typedef enum OnConflictAction
     800             : {
     801             :     ONCONFLICT_NONE,            /* No "ON CONFLICT" clause */
     802             :     ONCONFLICT_NOTHING,         /* ON CONFLICT ... DO NOTHING */
     803             :     ONCONFLICT_UPDATE           /* ON CONFLICT ... DO UPDATE */
     804             : } OnConflictAction;
     805             : 
     806             : #endif                          /* NODES_H */

Generated by: LCOV version 1.11