From a64174dd3f04931283bb62b6076e84fce97e11dc Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Fri, 13 Nov 2015 00:12:02 +0200 Subject: [PATCH] In readfast.c/outfast.c, reuse functions from readfuncs.c/outfuncs.c. Currently, readfast.c / outfast.c are mostly copy-pasted from readfuncs.c / outfuncs.c. That's a merge hazard: if a new field is added to a struct in upstream, and it's added to readfuncs.c and outfuncs.c, we would need to manually do the same in the readfast.c/outfast.c. If the patch applies cleanly, we will not notice, and we'll have a bug of omission. Refactor the code so that all those node types where the text and binary functions are identical, the duplicate in [read/out]fast.c is removed, and the definition [read/out]funcs.c is used to compile the binary version too. This involves some tricks with #ifdefs and #includes, but cuts a lot of duplicate code. This should avoid the merge hazard. We'll still need to maintain the read/out functions whenever we modify a struct in Greenplum, but that's no different from what needs to be done in PostgreSQL. --- src/Makefile.mock | 2 + src/backend/nodes/Makefile | 4 + src/backend/nodes/outfast.c | 2737 +-------------------------------- src/backend/nodes/outfuncs.c | 135 +- src/backend/nodes/readfast.c | 1706 ++------------------ src/backend/nodes/readfuncs.c | 122 +- 6 files changed, 444 insertions(+), 4262 deletions(-) diff --git a/src/Makefile.mock b/src/Makefile.mock index 58819b4e1d..d83e9ff9c0 100644 --- a/src/Makefile.mock +++ b/src/Makefile.mock @@ -17,6 +17,8 @@ MOCK_LIBS := -ldl $(filter-out -lpgport -ledit, $(LIBS)) EXCL_OBJS=src/backend/bootstrap/bootparse.o \ src/backend/catalog/caql/gram.o \ src/backend/parser/gram.o \ + src/backend/nodes/readfast.o \ + src/backend/nodes/outfast.o \ src/backend/regex/regcomp.o \ src/backend/regex/regexec.o \ src/backend/utils/adt/like.o \ diff --git a/src/backend/nodes/Makefile b/src/backend/nodes/Makefile index f11931503d..197ca6af3f 100644 --- a/src/backend/nodes/Makefile +++ b/src/backend/nodes/Makefile @@ -17,4 +17,8 @@ OBJS = nodeFuncs.o nodes.o list.o bitmapset.o tidbitmap.o \ outfuncs.o readfuncs.o print.o read.o params.o value.o \ outfast.o readfast.o +# readfast.c #includes readfuncs.c. Same with outfast.c and outfast.c +readfast.o: readfuncs.c +outfast.o: outfuncs.c + include $(top_srcdir)/src/backend/common.mk diff --git a/src/backend/nodes/outfast.c b/src/backend/nodes/outfast.c index 88c2be1520..7475e43027 100644 --- a/src/backend/nodes/outfast.c +++ b/src/backend/nodes/outfast.c @@ -18,8 +18,8 @@ * By design, the only user of these routines is the function * serializeNode in cdbsrlz.c. Other callers beware. * - * This file is based on outfuncs.c, however, it is optimized for speed - * at the expense legibility. + * Like readfast.c, this file borrows the definitions of most functions + * from outfuncs.c. * * Rather than serialize to a (somewhat human-readable) string, these * routines create a binary serialization via a simple depth-first walk @@ -107,12 +107,6 @@ #define WRITE_NODE_FIELD(fldname) \ (_outNode(str, node->fldname)) -/* Write a List field: this is a shortcut (you can call - * WRITE_NODE_FIELD for list fields) to avoid an extra call to - * _outNode() */ -#define WRITE_LIST_FIELD(fldname) \ - (_outList(str, node->fldname)) - /* Write a bitmapset field */ #define WRITE_BITMAPSET_FIELD(fldname) \ _outBitmapset(str, node->fldname) @@ -259,6 +253,8 @@ _outDatum(StringInfo str, Datum value, int typlen, bool typbyval) } } +#define COMPILING_BINARY_FUNCS +#include "outfuncs.c" /* * Stuff from plannodes.h @@ -270,7 +266,6 @@ _outDatum(StringInfo str, Datum value, int typlen, bool typbyval) static void _outPlanInfo(StringInfo str, Plan *node) { - if (print_variable_fields) { WRITE_INT_FIELD(plan_node_id); @@ -289,7 +284,7 @@ _outPlanInfo(StringInfo str, Plan *node) WRITE_BITMAPSET_FIELD(allParam); WRITE_INT_FIELD(nParamExec); - + if (print_variable_fields) { WRITE_NODE_FIELD(flow); @@ -313,78 +308,27 @@ _outPlanInfo(StringInfo str, Plan *node) } } -/* - * print the basic stuff of all nodes that inherit from Scan - */ -static void -_outScanInfo(StringInfo str, Scan *node) -{ - _outPlanInfo(str, (Plan *) node); - - if (print_variable_fields) - { - WRITE_UINT_FIELD(scanrelid); - } - else - { - /* - * Serializing for workfile caching. - * Instead of outputing rtable indices, serialize the actual rtable entry - */ - Assert(range_table != NULL); - - RangeTblEntry *rte = rt_fetch(node->scanrelid, range_table); - /* - * Serialize all rtable entries except for subquery type. - * For subquery scan, the rtable entry contains the entire plan of the - * subquery, but this is serialized elsewhere in outSubqueryScan, no - * need to duplicate it here - */ - if (rte->type != RTE_SUBQUERY) - { - _outNode(str,rte); - } - } - - WRITE_INT_FIELD(partIndex); - WRITE_INT_FIELD(partIndexPrintable); -} - -/* - * print the basic stuff of all nodes that inherit from Join - */ -static void -_outJoinPlanInfo(StringInfo str, Join *node) -{ - _outPlanInfo(str, (Plan *) node); - - WRITE_BOOL_FIELD(prefetch_inner); - - WRITE_ENUM_FIELD(jointype, JoinType); - WRITE_NODE_FIELD(joinqual); -} - static void _outPlannedStmt(StringInfo str, PlannedStmt *node) { WRITE_NODE_TYPE("PLANNEDSTMT"); - + WRITE_ENUM_FIELD(commandType, CmdType); WRITE_ENUM_FIELD(planGen, PlanGenerator); WRITE_BOOL_FIELD(canSetTag); WRITE_BOOL_FIELD(transientPlan); - + WRITE_NODE_FIELD(planTree); - + WRITE_NODE_FIELD(rtable); - + WRITE_NODE_FIELD(resultRelations); WRITE_NODE_FIELD(utilityStmt); WRITE_NODE_FIELD(intoClause); WRITE_NODE_FIELD(subplans); WRITE_NODE_FIELD(rewindPlanIDs); WRITE_NODE_FIELD(returningLists); - + WRITE_NODE_FIELD(result_partitions); WRITE_NODE_FIELD(result_aosegnos); WRITE_NODE_FIELD(queryPartOids); @@ -396,251 +340,26 @@ _outPlannedStmt(StringInfo str, PlannedStmt *node) WRITE_INT_FIELD(nCrossLevelParams); WRITE_INT_FIELD(nMotionNodes); WRITE_INT_FIELD(nInitPlans); - + /* Don't serialize policy */ WRITE_NODE_FIELD(sliceTable); - + WRITE_UINT64_FIELD(query_mem); WRITE_NODE_FIELD(transientTypeRecords); } -static void -_outPlan(StringInfo str, Plan *node) -{ - WRITE_NODE_TYPE("PLAN"); - - _outPlanInfo(str, (Plan *) node); -} - -static void -_outResult(StringInfo str, Result *node) -{ - WRITE_NODE_TYPE("RESULT"); - - _outPlanInfo(str, (Plan *) node); - - WRITE_NODE_FIELD(resconstantqual); - - WRITE_BOOL_FIELD(hashFilter); - WRITE_NODE_FIELD(hashList); -} - -static void -_outRepeat(StringInfo str, Repeat *node) -{ - WRITE_NODE_TYPE("REPEAT"); - - _outPlanInfo(str, (Plan *) node); - - WRITE_NODE_FIELD(repeatCountExpr); - WRITE_UINT64_FIELD(grouping); -} - -static void -_outAppend(StringInfo str, Append *node) -{ - WRITE_NODE_TYPE("APPEND"); - - _outPlanInfo(str, (Plan *) node); - - WRITE_NODE_FIELD(appendplans); - WRITE_BOOL_FIELD(isTarget); - WRITE_BOOL_FIELD(isZapped); - WRITE_BOOL_FIELD(hasXslice); -} - -static void -_outSequence(StringInfo str, Sequence *node) -{ - WRITE_NODE_TYPE("SEQUENCE"); - _outPlanInfo(str, (Plan *)node); - WRITE_NODE_FIELD(subplans); -} - -static void -_outBitmapAnd(StringInfo str, BitmapAnd *node) -{ - WRITE_NODE_TYPE("BITMAPAND"); - - _outPlanInfo(str, (Plan *) node); - - WRITE_LIST_FIELD(bitmapplans); -} - -static void -_outBitmapOr(StringInfo str, BitmapOr *node) -{ - WRITE_NODE_TYPE("BITMAPOR"); - - _outPlanInfo(str, (Plan *) node); - - WRITE_LIST_FIELD(bitmapplans); -} - -static void -_outScan(StringInfo str, Scan *node) -{ - WRITE_NODE_TYPE("SCAN"); - - _outScanInfo(str, (Scan *) node); -} - -static void -_outSeqScan(StringInfo str, SeqScan *node) -{ - WRITE_NODE_TYPE("SEQSCAN"); - - _outScanInfo(str, (Scan *) node); -} - -static void -_outAppendOnlyScan(StringInfo str, AppendOnlyScan *node) -{ - WRITE_NODE_TYPE("APPENDONLYSCAN"); - - _outScanInfo(str, (Scan *) node); -} - -static void -_outAOCSScan(StringInfo str, AOCSScan *node) -{ - WRITE_NODE_TYPE("AOCSSCAN"); - - _outScanInfo(str, (Scan *) node); -} - -static void -_outTableScan(StringInfo str, TableScan *node) -{ - WRITE_NODE_TYPE("TABLESCAN"); - _outScanInfo(str, (Scan *)node); -} -static void -_outDynamicTableScan(StringInfo str, DynamicTableScan *node) -{ - WRITE_NODE_TYPE("DYNAMICTABLESCAN"); - _outScanInfo(str, (Scan *)node); - WRITE_INT_FIELD(partIndex); - WRITE_INT_FIELD(partIndexPrintable); -} -static void -_outExternalScan(StringInfo str, ExternalScan *node) -{ - WRITE_NODE_TYPE("EXTERNALSCAN"); - - _outScanInfo(str, (Scan *) node); - - WRITE_NODE_FIELD(uriList); - WRITE_NODE_FIELD(fmtOpts); - WRITE_CHAR_FIELD(fmtType); - WRITE_BOOL_FIELD(isMasterOnly); - WRITE_INT_FIELD(rejLimit); - WRITE_BOOL_FIELD(rejLimitInRows); - WRITE_OID_FIELD(fmterrtbl); - WRITE_INT_FIELD(encoding); - WRITE_INT_FIELD(scancounter); -} - static void outLogicalIndexInfo(StringInfo str, LogicalIndexInfo *node) { WRITE_OID_FIELD(logicalIndexOid); WRITE_INT_FIELD(nColumns); WRITE_INT_ARRAY(indexKeys, nColumns, AttrNumber); - WRITE_LIST_FIELD(indPred); - WRITE_LIST_FIELD(indExprs); + WRITE_NODE_FIELD(indPred); + WRITE_NODE_FIELD(indExprs); WRITE_BOOL_FIELD(indIsUnique); WRITE_ENUM_FIELD(indType, LogicalIndexType); WRITE_NODE_FIELD(partCons); - WRITE_LIST_FIELD(defaultLevels); -} - -static void -outIndexScanFields(StringInfo str, IndexScan *node) -{ - _outScanInfo(str, (Scan *) node); - - WRITE_OID_FIELD(indexid); - WRITE_LIST_FIELD(indexqual); - WRITE_LIST_FIELD(indexqualorig); - WRITE_LIST_FIELD(indexstrategy); - WRITE_LIST_FIELD(indexsubtype); - WRITE_ENUM_FIELD(indexorderdir, ScanDirection); - - if (isDynamicScan(&node->scan)) - { - Assert(node->logicalIndexInfo); - outLogicalIndexInfo(str, node->logicalIndexInfo); - } - else - { - Assert(node->logicalIndexInfo == NULL); - } -} - -static void -_outIndexScan(StringInfo str, IndexScan *node) -{ - WRITE_NODE_TYPE("INDEXSCAN"); - - outIndexScanFields(str, node); -} - -static void -_outDynamicIndexScan(StringInfo str, DynamicIndexScan *node) -{ - WRITE_NODE_TYPE("DYNAMICINDEXSCAN"); - /* DynamicIndexScan has the same content as IndexScan. */ - outIndexScanFields(str, (IndexScan *) node); -} - -static void -_outBitmapIndexScan(StringInfo str, BitmapIndexScan *node) -{ - WRITE_NODE_TYPE("BITMAPINDEXSCAN"); - /* BitmapIndexScan has the same content as IndexScan. */ - outIndexScanFields(str, (IndexScan *) node); -} - -static void -_outBitmapHeapScan(StringInfo str, BitmapHeapScan *node) -{ - WRITE_NODE_TYPE("BITMAPHEAPSCAN"); - - _outScanInfo(str, (Scan *) node); - - WRITE_LIST_FIELD(bitmapqualorig); -} - -static void -_outBitmapAppendOnlyScan(StringInfo str, BitmapAppendOnlyScan *node) -{ - WRITE_NODE_TYPE("BITMAPAPPENDONLYSCAN"); - - _outScanInfo(str, (Scan *) node); - - WRITE_LIST_FIELD(bitmapqualorig); - WRITE_BOOL_FIELD(isAORow); -} - -static void -_outBitmapTableScan(StringInfo str, BitmapTableScan *node) -{ - WRITE_NODE_TYPE("BITMAPTABLESCAN"); - - _outScanInfo(str, (Scan *) node); - - WRITE_LIST_FIELD(bitmapqualorig); -} - -static void -_outTidScan(StringInfo str, TidScan *node) -{ - WRITE_NODE_TYPE("TIDSCAN"); - - _outScanInfo(str, (Scan *) node); - - WRITE_NODE_FIELD(tidquals); + WRITE_NODE_FIELD(defaultLevels); } static void @@ -654,65 +373,6 @@ _outSubqueryScan(StringInfo str, SubqueryScan *node) /* Planner-only: subrtable -- don't serialize. */ } -static void -_outFunctionScan(StringInfo str, FunctionScan *node) -{ - WRITE_NODE_TYPE("FUNCTIONSCAN"); - - _outScanInfo(str, (Scan *) node); -} - -static void -_outValuesScan(StringInfo str, ValuesScan *node) -{ - WRITE_NODE_TYPE("VALUESSCAN"); - - _outScanInfo(str, (Scan *) node); -} - -static void -_outJoin(StringInfo str, Join *node) -{ - WRITE_NODE_TYPE("JOIN"); - - _outJoinPlanInfo(str, (Join *) node); -} - -static void -_outNestLoop(StringInfo str, NestLoop *node) -{ - WRITE_NODE_TYPE("NESTLOOP"); - - _outJoinPlanInfo(str, (Join *) node); - - WRITE_BOOL_FIELD(outernotreferencedbyinner); /*CDB*/ - WRITE_BOOL_FIELD(shared_outer); - WRITE_BOOL_FIELD(singleton_outer); /*CDB-OLAP*/ -} - - -static void -_outMergeJoin(StringInfo str, MergeJoin *node) -{ - WRITE_NODE_TYPE("MERGEJOIN"); - - _outJoinPlanInfo(str, (Join *) node); - - WRITE_LIST_FIELD(mergeclauses); - WRITE_BOOL_FIELD(unique_outer); -} - -static void -_outHashJoin(StringInfo str, HashJoin *node) -{ - WRITE_NODE_TYPE("HASHJOIN"); - - _outJoinPlanInfo(str, (Join *) node); - - WRITE_LIST_FIELD(hashclauses); - WRITE_LIST_FIELD(hashqualclauses); -} - static void _outAgg(StringInfo str, Agg *node) { @@ -766,42 +426,6 @@ _outWindow(StringInfo str, Window *node) WRITE_NODE_FIELD(windowKeys); } -static void -_outTableFunctionScan(StringInfo str, TableFunctionScan *node) -{ - WRITE_NODE_TYPE("TABLEFUNCTIONSCAN"); - - _outScanInfo(str, (Scan *) node); -} - -static void -_outMaterial(StringInfo str, Material *node) -{ - WRITE_NODE_TYPE("MATERIAL"); - - WRITE_BOOL_FIELD(cdb_strict); - - WRITE_ENUM_FIELD(share_type, ShareType); - WRITE_INT_FIELD(share_id); - WRITE_INT_FIELD(driver_slice); - WRITE_INT_FIELD(nsharer); - WRITE_INT_FIELD(nsharer_xslice); - - _outPlanInfo(str, (Plan *) node); -} - -static void -_outShareInputScan(StringInfo str, ShareInputScan *node) -{ - WRITE_NODE_TYPE("SHAREINPUTSCAN"); - - WRITE_ENUM_FIELD(share_type, ShareType); - WRITE_INT_FIELD(share_id); - WRITE_INT_FIELD(driver_slice); - - _outPlanInfo(str, (Plan *) node); -} - static void _outSort(StringInfo str, Sort *node) { @@ -858,26 +482,6 @@ _outSetOp(StringInfo str, SetOp *node) WRITE_INT_FIELD(flagColIdx); } -static void -_outLimit(StringInfo str, Limit *node) -{ - WRITE_NODE_TYPE("LIMIT"); - - _outPlanInfo(str, (Plan *) node); - - WRITE_NODE_FIELD(limitOffset); - WRITE_NODE_FIELD(limitCount); -} - -static void -_outHash(StringInfo str, Hash *node) -{ - WRITE_NODE_TYPE("HASH"); - - _outPlanInfo(str, (Plan *) node); - WRITE_BOOL_FIELD(rescannable); /*CDB*/ -} - static void _outMotion(StringInfo str, Motion *node) { @@ -888,8 +492,8 @@ _outMotion(StringInfo str, Motion *node) WRITE_ENUM_FIELD(motionType, MotionType); WRITE_BOOL_FIELD(sendSorted); - WRITE_LIST_FIELD(hashExpr); - WRITE_LIST_FIELD(hashDataTypes); + WRITE_NODE_FIELD(hashExpr); + WRITE_NODE_FIELD(hashDataTypes); WRITE_INT_FIELD(numOutputSegs); WRITE_INT_ARRAY(outputSegIdx, numOutputSegs, int); @@ -903,94 +507,6 @@ _outMotion(StringInfo str, Motion *node) _outPlanInfo(str, (Plan *) node); } -/* - * _outDML - */ -static void -_outDML(StringInfo str, DML *node) -{ - WRITE_NODE_TYPE("DML"); - - WRITE_UINT_FIELD(scanrelid); - WRITE_INT_FIELD(oidColIdx); - WRITE_INT_FIELD(actionColIdx); - WRITE_INT_FIELD(ctidColIdx); - WRITE_INT_FIELD(tupleoidColIdx); - - _outPlanInfo(str, (Plan *) node); -} - - -/* - * _outSplitUpdate - */ -static void -_outSplitUpdate(StringInfo str, SplitUpdate *node) -{ - WRITE_NODE_TYPE("SPLITUPDATE"); - - WRITE_INT_FIELD(actionColIdx); - WRITE_INT_FIELD(ctidColIdx); - WRITE_INT_FIELD(tupleoidColIdx); - WRITE_NODE_FIELD(insertColIdx); - WRITE_NODE_FIELD(deleteColIdx); - - _outPlanInfo(str, (Plan *) node); -} - -/* - * _outRowTrigger - */ -static void -_outRowTrigger(StringInfo str, RowTrigger *node) -{ - WRITE_NODE_TYPE("ROWTRIGGER"); - - WRITE_INT_FIELD(relid); - WRITE_INT_FIELD(eventFlags); - WRITE_NODE_FIELD(oldValuesColIdx); - WRITE_NODE_FIELD(newValuesColIdx); - - _outPlanInfo(str, (Plan *) node); -} - -/* - * _outAssertOp - */ -static void -_outAssertOp(StringInfo str, AssertOp *node) -{ - WRITE_NODE_TYPE("ASSERTOP"); - - WRITE_NODE_FIELD(errmessage); - WRITE_INT_FIELD(errcode); - - _outPlanInfo(str, (Plan *) node); -} - -/* - * _outPartitionSelector - */ -static void -_outPartitionSelector(StringInfo str, PartitionSelector *node) -{ - WRITE_NODE_TYPE("PARTITIONSELECTOR"); - - WRITE_INT_FIELD(relid); - WRITE_INT_FIELD(nLevels); - WRITE_INT_FIELD(scanId); - WRITE_INT_FIELD(selectorId); - WRITE_NODE_FIELD(levelEqExpressions); - WRITE_NODE_FIELD(levelExpressions); - WRITE_NODE_FIELD(residualPredicate); - WRITE_NODE_FIELD(propagationExpression); - WRITE_NODE_FIELD(printablePredicate); - WRITE_BOOL_FIELD(staticSelection); - WRITE_NODE_FIELD(staticPartOids); - WRITE_NODE_FIELD(staticScanIds); - - _outPlanInfo(str, (Plan *) node); -} /***************************************************************************** * @@ -998,79 +514,6 @@ _outPartitionSelector(StringInfo str, PartitionSelector *node) * *****************************************************************************/ -static void -_outAlias(StringInfo str, Alias *node) -{ - WRITE_NODE_TYPE("ALIAS"); - - WRITE_STRING_FIELD(aliasname); - WRITE_NODE_FIELD(colnames); -} - -static void -_outRangeVar(StringInfo str, RangeVar *node) -{ - WRITE_NODE_TYPE("RANGEVAR"); - - /* - * we deliberately ignore catalogname here, since it is presently not - * semantically meaningful - */ - WRITE_STRING_FIELD(schemaname); - WRITE_STRING_FIELD(relname); - WRITE_ENUM_FIELD(inhOpt, InhOption); - WRITE_BOOL_FIELD(istemp); - WRITE_NODE_FIELD(alias); - WRITE_INT_FIELD(location); /*CDB*/ -} - -static void -_outIntoClause(StringInfo str, IntoClause *node) -{ - WRITE_NODE_TYPE("INTOCLAUSE"); - - WRITE_NODE_FIELD(rel); - WRITE_NODE_FIELD(colNames); - WRITE_NODE_FIELD(options); - WRITE_ENUM_FIELD(onCommit, OnCommitAction); - WRITE_STRING_FIELD(tableSpaceName); - WRITE_OID_FIELD(oidInfo.relOid); - WRITE_OID_FIELD(oidInfo.comptypeOid); - WRITE_OID_FIELD(oidInfo.toastOid); - WRITE_OID_FIELD(oidInfo.toastIndexOid); - WRITE_OID_FIELD(oidInfo.toastComptypeOid); - WRITE_OID_FIELD(oidInfo.aosegOid); - WRITE_OID_FIELD(oidInfo.aosegIndexOid); - WRITE_OID_FIELD(oidInfo.aosegComptypeOid); - WRITE_OID_FIELD(oidInfo.aovisimapOid); - WRITE_OID_FIELD(oidInfo.aovisimapIndexOid); - WRITE_OID_FIELD(oidInfo.aovisimapComptypeOid); - WRITE_OID_FIELD(oidInfo.aoblkdirOid); - WRITE_OID_FIELD(oidInfo.aoblkdirIndexOid); - WRITE_OID_FIELD(oidInfo.aoblkdirComptypeOid); - -} - -static void -_outVar(StringInfo str, Var *node) -{ - WRITE_NODE_TYPE("VAR"); - - if (print_variable_fields) - { - WRITE_UINT_FIELD(varno); - } - WRITE_INT_FIELD(varattno); - WRITE_OID_FIELD(vartype); - WRITE_INT_FIELD(vartypmod); - WRITE_UINT_FIELD(varlevelsup); - if (print_variable_fields) - { - WRITE_UINT_FIELD(varnoold); - } - WRITE_INT_FIELD(varoattno); -} - static void _outConst(StringInfo str, Const *node) { @@ -1085,16 +528,6 @@ _outConst(StringInfo str, Const *node) _outDatum(str, node->constvalue, node->constlen, node->constbyval); } -static void -_outParam(StringInfo str, Param *node) -{ - WRITE_NODE_TYPE("PARAM"); - - WRITE_ENUM_FIELD(paramkind, ParamKind); - WRITE_INT_FIELD(paramid); - WRITE_OID_FIELD(paramtype); -} - static void _outAggref(StringInfo str, Aggref *node) { @@ -1112,46 +545,6 @@ _outAggref(StringInfo str, Aggref *node) } -static void -_outAggOrder(StringInfo str, AggOrder *node) -{ - WRITE_NODE_TYPE("AGGORDER"); - - WRITE_BOOL_FIELD(sortImplicit); - WRITE_NODE_FIELD(sortTargets); - WRITE_NODE_FIELD(sortClause); -} - -static void -_outWindowRef(StringInfo str, WindowRef *node) -{ - WRITE_NODE_TYPE("WINDOWREF"); - - WRITE_OID_FIELD(winfnoid); - WRITE_OID_FIELD(restype); - WRITE_NODE_FIELD(args); - WRITE_UINT_FIELD(winlevelsup); - WRITE_BOOL_FIELD(windistinct); - WRITE_UINT_FIELD(winspec); - WRITE_UINT_FIELD(winindex); - WRITE_ENUM_FIELD(winstage, WinStage); - WRITE_UINT_FIELD(winlevel); -} - - static void -_outArrayRef(StringInfo str, ArrayRef *node) -{ - WRITE_NODE_TYPE("ARRAYREF"); - - WRITE_OID_FIELD(refrestype); - WRITE_OID_FIELD(refarraytype); - WRITE_OID_FIELD(refelemtype); - WRITE_NODE_FIELD(refupperindexpr); - WRITE_NODE_FIELD(reflowerindexpr); - WRITE_NODE_FIELD(refexpr); - WRITE_NODE_FIELD(refassgnexpr); -} - static void _outFuncExpr(StringInfo str, FuncExpr *node) { @@ -1165,46 +558,9 @@ _outFuncExpr(StringInfo str, FuncExpr *node) WRITE_BOOL_FIELD(is_tablefunc); } -static void -_outOpExpr(StringInfo str, OpExpr *node) -{ - WRITE_NODE_TYPE("OPEXPR"); - - WRITE_OID_FIELD(opno); - WRITE_OID_FIELD(opfuncid); - WRITE_OID_FIELD(opresulttype); - WRITE_BOOL_FIELD(opretset); - WRITE_NODE_FIELD(args); -} - -static void -_outDistinctExpr(StringInfo str, DistinctExpr *node) -{ - WRITE_NODE_TYPE("DISTINCTEXPR"); - - WRITE_OID_FIELD(opno); - WRITE_OID_FIELD(opfuncid); - WRITE_OID_FIELD(opresulttype); - WRITE_BOOL_FIELD(opretset); - WRITE_NODE_FIELD(args); -} - -static void -_outScalarArrayOpExpr(StringInfo str, ScalarArrayOpExpr *node) -{ - WRITE_NODE_TYPE("SCALARARRAYOPEXPR"); - - WRITE_OID_FIELD(opno); - WRITE_OID_FIELD(opfuncid); - WRITE_BOOL_FIELD(useOr); - WRITE_NODE_FIELD(args); -} - static void _outBoolExpr(StringInfo str, BoolExpr *node) { - - WRITE_NODE_TYPE("BOOLEXPR"); WRITE_ENUM_FIELD(boolop, BoolExprType); @@ -1223,211 +579,6 @@ _outSubLink(StringInfo str, SubLink *node) WRITE_NODE_FIELD(subselect); } -static void -_outSubPlan(StringInfo str, SubPlan *node) -{ - WRITE_NODE_TYPE("SUBPLAN"); - - WRITE_INT_FIELD(qDispSliceId); /*CDB*/ - WRITE_ENUM_FIELD(subLinkType, SubLinkType); - WRITE_NODE_FIELD(testexpr); - WRITE_NODE_FIELD(paramIds); - WRITE_INT_FIELD(plan_id); - WRITE_OID_FIELD(firstColType); - WRITE_INT_FIELD(firstColTypmod); - WRITE_BOOL_FIELD(useHashTable); - WRITE_BOOL_FIELD(unknownEqFalse); - WRITE_BOOL_FIELD(is_initplan); /*CDB*/ - WRITE_BOOL_FIELD(is_multirow); /*CDB*/ - WRITE_NODE_FIELD(setParam); - WRITE_NODE_FIELD(parParam); - WRITE_NODE_FIELD(args); - WRITE_NODE_FIELD(extParam); -} - -static void -_outFieldSelect(StringInfo str, FieldSelect *node) -{ - WRITE_NODE_TYPE("FIELDSELECT"); - - WRITE_NODE_FIELD(arg); - WRITE_INT_FIELD(fieldnum); - WRITE_OID_FIELD(resulttype); - WRITE_INT_FIELD(resulttypmod); -} - -static void -_outFieldStore(StringInfo str, FieldStore *node) -{ - WRITE_NODE_TYPE("FIELDSTORE"); - - WRITE_NODE_FIELD(arg); - WRITE_NODE_FIELD(newvals); - WRITE_NODE_FIELD(fieldnums); - WRITE_OID_FIELD(resulttype); -} - -static void -_outRelabelType(StringInfo str, RelabelType *node) -{ - WRITE_NODE_TYPE("RELABELTYPE"); - - WRITE_NODE_FIELD(arg); - WRITE_OID_FIELD(resulttype); - WRITE_INT_FIELD(resulttypmod); - WRITE_ENUM_FIELD(relabelformat, CoercionForm); -} - -static void -_outConvertRowtypeExpr(StringInfo str, ConvertRowtypeExpr *node) -{ - WRITE_NODE_TYPE("CONVERTROWTYPEEXPR"); - - WRITE_NODE_FIELD(arg); - WRITE_OID_FIELD(resulttype); - WRITE_ENUM_FIELD(convertformat, CoercionForm); -} - -static void -_outCaseExpr(StringInfo str, CaseExpr *node) -{ - WRITE_NODE_TYPE("CASE"); - - WRITE_OID_FIELD(casetype); - WRITE_NODE_FIELD(arg); - WRITE_NODE_FIELD(args); - WRITE_NODE_FIELD(defresult); -} - -static void -_outCaseWhen(StringInfo str, CaseWhen *node) -{ - WRITE_NODE_TYPE("WHEN"); - - WRITE_NODE_FIELD(expr); - WRITE_NODE_FIELD(result); -} - -static void -_outCaseTestExpr(StringInfo str, CaseTestExpr *node) -{ - WRITE_NODE_TYPE("CASETESTEXPR"); - - WRITE_OID_FIELD(typeId); - WRITE_INT_FIELD(typeMod); -} - -static void -_outArrayExpr(StringInfo str, ArrayExpr *node) -{ - WRITE_NODE_TYPE("ARRAY"); - - WRITE_OID_FIELD(array_typeid); - WRITE_OID_FIELD(element_typeid); - WRITE_NODE_FIELD(elements); - WRITE_BOOL_FIELD(multidims); -} - -static void -_outRowExpr(StringInfo str, RowExpr *node) -{ - WRITE_NODE_TYPE("ROW"); - - WRITE_NODE_FIELD(args); - WRITE_OID_FIELD(row_typeid); - WRITE_ENUM_FIELD(row_format, CoercionForm); -} - -static void -_outRowCompareExpr(StringInfo str, RowCompareExpr *node) -{ - WRITE_NODE_TYPE("ROWCOMPARE"); - - WRITE_ENUM_FIELD(rctype, RowCompareType); - WRITE_NODE_FIELD(opnos); - WRITE_NODE_FIELD(opclasses); - WRITE_NODE_FIELD(largs); - WRITE_NODE_FIELD(rargs); -} - -static void -_outCoalesceExpr(StringInfo str, CoalesceExpr *node) -{ - WRITE_NODE_TYPE("COALESCE"); - - WRITE_OID_FIELD(coalescetype); - WRITE_NODE_FIELD(args); -} - -static void -_outMinMaxExpr(StringInfo str, MinMaxExpr *node) -{ - WRITE_NODE_TYPE("MINMAX"); - - WRITE_OID_FIELD(minmaxtype); - WRITE_ENUM_FIELD(op, MinMaxOp); - WRITE_NODE_FIELD(args); -} - -static void -_outNullIfExpr(StringInfo str, NullIfExpr *node) -{ - WRITE_NODE_TYPE("NULLIFEXPR"); - - WRITE_OID_FIELD(opno); - WRITE_OID_FIELD(opfuncid); - WRITE_OID_FIELD(opresulttype); - WRITE_BOOL_FIELD(opretset); - WRITE_NODE_FIELD(args); -} - -static void -_outNullTest(StringInfo str, NullTest *node) -{ - WRITE_NODE_TYPE("NULLTEST"); - - WRITE_NODE_FIELD(arg); - WRITE_ENUM_FIELD(nulltesttype, NullTestType); -} - -static void -_outBooleanTest(StringInfo str, BooleanTest *node) -{ - WRITE_NODE_TYPE("BOOLEANTEST"); - - WRITE_NODE_FIELD(arg); - WRITE_ENUM_FIELD(booltesttype, BoolTestType); -} - -static void -_outCoerceToDomain(StringInfo str, CoerceToDomain *node) -{ - WRITE_NODE_TYPE("COERCETODOMAIN"); - - WRITE_NODE_FIELD(arg); - WRITE_OID_FIELD(resulttype); - WRITE_INT_FIELD(resulttypmod); - WRITE_ENUM_FIELD(coercionformat, CoercionForm); -} - -static void -_outCoerceToDomainValue(StringInfo str, CoerceToDomainValue *node) -{ - WRITE_NODE_TYPE("COERCETODOMAINVALUE"); - - WRITE_OID_FIELD(typeId); - WRITE_INT_FIELD(typeMod); -} - -static void -_outSetToDefault(StringInfo str, SetToDefault *node) -{ - WRITE_NODE_TYPE("SETTODEFAULT"); - - WRITE_OID_FIELD(typeId); - WRITE_INT_FIELD(typeMod); -} - static void _outCurrentOfExpr(StringInfo str, CurrentOfExpr *node) { @@ -1437,32 +588,10 @@ _outCurrentOfExpr(StringInfo str, CurrentOfExpr *node) WRITE_UINT_FIELD(cvarno); WRITE_OID_FIELD(target_relid); WRITE_INT_FIELD(gp_segment_id); - WRITE_BINARY_FIELD(ctid, sizeof(ItemPointerData)); + WRITE_BINARY_FIELD(ctid, sizeof(ItemPointerData)); WRITE_OID_FIELD(tableoid); } -static void -_outTargetEntry(StringInfo str, TargetEntry *node) -{ - WRITE_NODE_TYPE("TARGETENTRY"); - - WRITE_NODE_FIELD(expr); - WRITE_INT_FIELD(resno); - WRITE_STRING_FIELD(resname); - WRITE_UINT_FIELD(ressortgroupref); - WRITE_OID_FIELD(resorigtbl); - WRITE_INT_FIELD(resorigcol); - WRITE_BOOL_FIELD(resjunk); -} - -static void -_outRangeTblRef(StringInfo str, RangeTblRef *node) -{ - WRITE_NODE_TYPE("RANGETBLREF"); - - WRITE_INT_FIELD(rtindex); -} - static void _outJoinExpr(StringInfo str, JoinExpr *node) { @@ -1478,15 +607,6 @@ _outJoinExpr(StringInfo str, JoinExpr *node) WRITE_INT_FIELD(rtindex); } -static void -_outFromExpr(StringInfo str, FromExpr *node) -{ - WRITE_NODE_TYPE("FROMEXPR"); - - WRITE_NODE_FIELD(fromlist); - WRITE_NODE_FIELD(quals); -} - static void _outFlow(StringInfo str, Flow *node) { @@ -1512,314 +632,14 @@ _outFlow(StringInfo str, Flow *node) /***************************************************************************** * - * Stuff from cdbpathlocus.h. + * Stuff from relation.h. * *****************************************************************************/ -/* - * _outCdbPathLocus - */ static void -_outCdbPathLocus(StringInfo str, CdbPathLocus *node) +_outIndexOptInfo(StringInfo str, IndexOptInfo *node) { - WRITE_ENUM_FIELD(locustype, CdbLocusType); - WRITE_NODE_FIELD(partkey); -} /* _outCdbPathLocus */ - - -/***************************************************************************** - * - * Stuff from relation.h. - * - *****************************************************************************/ - -/* - * print the basic stuff of all nodes that inherit from Path - * - * Note we do NOT print the parent, else we'd be in infinite recursion - */ -static void -_outPathInfo(StringInfo str, Path *node) -{ - WRITE_ENUM_FIELD(pathtype, NodeTag); - WRITE_FLOAT_FIELD(startup_cost, "%.2f"); - WRITE_FLOAT_FIELD(total_cost, "%.2f"); - WRITE_NODE_FIELD(parent); - _outCdbPathLocus(str, &node->locus); - WRITE_NODE_FIELD(pathkeys); -} - -/* - * print the basic stuff of all nodes that inherit from JoinPath - */ -static void -_outJoinPathInfo(StringInfo str, JoinPath *node) -{ - _outPathInfo(str, (Path *) node); - - WRITE_ENUM_FIELD(jointype, JoinType); - WRITE_NODE_FIELD(outerjoinpath); - WRITE_NODE_FIELD(innerjoinpath); - WRITE_NODE_FIELD(joinrestrictinfo); -} - -static void -_outPath(StringInfo str, Path *node) -{ - WRITE_NODE_TYPE("PATH"); - - _outPathInfo(str, (Path *) node); -} - -static void -_outIndexPath(StringInfo str, IndexPath *node) -{ - WRITE_NODE_TYPE("INDEXPATH"); - - _outPathInfo(str, (Path *) node); - - WRITE_NODE_FIELD(indexinfo); - WRITE_NODE_FIELD(indexclauses); - WRITE_NODE_FIELD(indexquals); - WRITE_BOOL_FIELD(isjoininner); - WRITE_ENUM_FIELD(indexscandir, ScanDirection); - WRITE_FLOAT_FIELD(indextotalcost, "%.2f"); - WRITE_FLOAT_FIELD(indexselectivity, "%.4f"); - WRITE_FLOAT_FIELD(rows, "%.0f"); - WRITE_INT_FIELD(num_leading_eq); -} - -static void -_outBitmapHeapPath(StringInfo str, BitmapHeapPath *node) -{ - WRITE_NODE_TYPE("BITMAPHEAPPATH"); - - _outPathInfo(str, (Path *) node); - - WRITE_NODE_FIELD(bitmapqual); - WRITE_BOOL_FIELD(isjoininner); - WRITE_FLOAT_FIELD(rows, "%.0f"); -} - -static void -_outBitmapAppendOnlyPath(StringInfo str, BitmapAppendOnlyPath *node) -{ - WRITE_NODE_TYPE("BITMAPAPPENDONLYPATH"); - - _outPathInfo(str, (Path *) node); - - WRITE_NODE_FIELD(bitmapqual); - WRITE_BOOL_FIELD(isjoininner); - WRITE_FLOAT_FIELD(rows, "%.0f"); - WRITE_BOOL_FIELD(isAORow); -} - -static void -_outBitmapAndPath(StringInfo str, BitmapAndPath *node) -{ - WRITE_NODE_TYPE("BITMAPANDPATH"); - - _outPathInfo(str, (Path *) node); - - WRITE_NODE_FIELD(bitmapquals); - WRITE_FLOAT_FIELD(bitmapselectivity, "%.4f"); -} - -static void -_outBitmapOrPath(StringInfo str, BitmapOrPath *node) -{ - WRITE_NODE_TYPE("BITMAPORPATH"); - - _outPathInfo(str, (Path *) node); - - WRITE_NODE_FIELD(bitmapquals); - WRITE_FLOAT_FIELD(bitmapselectivity, "%.4f"); -} - -static void -_outTidPath(StringInfo str, TidPath *node) -{ - WRITE_NODE_TYPE("TIDPATH"); - - _outPathInfo(str, (Path *) node); - - WRITE_NODE_FIELD(tidquals); -} - -static void -_outAppendPath(StringInfo str, AppendPath *node) -{ - WRITE_NODE_TYPE("APPENDPATH"); - - _outPathInfo(str, (Path *) node); - - WRITE_NODE_FIELD(subpaths); -} - -static void -_outAppendOnlyPath(StringInfo str, AppendOnlyPath *node) -{ - WRITE_NODE_TYPE("APPENDONLYPATH"); - - _outPathInfo(str, (Path *) node); -} - -static void -_outAOCSPath(StringInfo str, AOCSPath *node) -{ - WRITE_NODE_TYPE("AOCSPATH"); - - _outPathInfo(str, (Path *) node); -} -static void -_outResultPath(StringInfo str, ResultPath *node) -{ - WRITE_NODE_TYPE("RESULTPATH"); - - _outPathInfo(str, (Path *) node); - - WRITE_NODE_FIELD(quals); -} - -static void -_outMaterialPath(StringInfo str, MaterialPath *node) -{ - WRITE_NODE_TYPE("MATERIALPATH"); - - _outPathInfo(str, (Path *) node); - WRITE_BOOL_FIELD(cdb_strict); - - WRITE_NODE_FIELD(subpath); -} - -static void -_outUniquePath(StringInfo str, UniquePath *node) -{ - WRITE_NODE_TYPE("UNIQUEPATH"); - - _outPathInfo(str, (Path *) node); - WRITE_ENUM_FIELD(umethod, UniquePathMethod); - WRITE_FLOAT_FIELD(rows, "%.0f"); - WRITE_BOOL_FIELD(must_repartition); /*CDB*/ - WRITE_BITMAPSET_FIELD(distinct_on_rowid_relids); /*CDB*/ - WRITE_NODE_FIELD(distinct_on_exprs); /*CDB*/ - - WRITE_NODE_FIELD(subpath); -} - -static void -_outNestPath(StringInfo str, NestPath *node) -{ - WRITE_NODE_TYPE("NESTPATH"); - - _outJoinPathInfo(str, (JoinPath *) node); -} - -static void -_outMergePath(StringInfo str, MergePath *node) -{ - WRITE_NODE_TYPE("MERGEPATH"); - - _outJoinPathInfo(str, (JoinPath *) node); - - WRITE_NODE_FIELD(path_mergeclauses); - WRITE_NODE_FIELD(outersortkeys); - WRITE_NODE_FIELD(innersortkeys); -} - -static void -_outHashPath(StringInfo str, HashPath *node) -{ - WRITE_NODE_TYPE("HASHPATH"); - - _outJoinPathInfo(str, (JoinPath *) node); - - WRITE_NODE_FIELD(path_hashclauses); -} - -static void -_outCdbMotionPath(StringInfo str, CdbMotionPath *node) -{ - WRITE_NODE_TYPE("MOTIONPATH"); - - _outPathInfo(str, &node->path); - - WRITE_NODE_FIELD(subpath); -} - -static void -_outPlannerInfo(StringInfo str, PlannerInfo *node) -{ - WRITE_NODE_TYPE("PLANNERINFO"); - - /* NB: this isn't a complete set of fields */ - WRITE_NODE_FIELD(parse); - WRITE_NODE_FIELD(join_rel_list); - WRITE_NODE_FIELD(equi_key_list); - WRITE_NODE_FIELD(left_join_clauses); - WRITE_NODE_FIELD(right_join_clauses); - WRITE_NODE_FIELD(full_join_clauses); - WRITE_NODE_FIELD(oj_info_list); - WRITE_NODE_FIELD(in_info_list); - WRITE_NODE_FIELD(append_rel_list); - WRITE_NODE_FIELD(query_pathkeys); - WRITE_NODE_FIELD(group_pathkeys); - WRITE_NODE_FIELD(sort_pathkeys); - WRITE_FLOAT_FIELD(total_table_pages, "%.0f"); - WRITE_FLOAT_FIELD(tuple_fraction, "%.4f"); - WRITE_BOOL_FIELD(hasJoinRTEs); - WRITE_BOOL_FIELD(hasOuterJoins); - WRITE_BOOL_FIELD(hasHavingQual); - WRITE_BOOL_FIELD(hasPseudoConstantQuals); -} - -static void -_outRelOptInfo(StringInfo str, RelOptInfo *node) -{ - WRITE_NODE_TYPE("RELOPTINFO"); - - /* NB: this isn't a complete set of fields */ - WRITE_ENUM_FIELD(reloptkind, RelOptKind); - WRITE_BITMAPSET_FIELD(relids); - WRITE_FLOAT_FIELD(rows, "%.0f"); - WRITE_INT_FIELD(width); - WRITE_NODE_FIELD(reltargetlist); - /* Skip writing Path ptrs to avoid endless recursion */ - /* WRITE_NODE_FIELD(pathlist); */ - /* WRITE_NODE_FIELD(cheapest_startup_path); */ - /* WRITE_NODE_FIELD(cheapest_total_path); */ - - WRITE_NODE_FIELD(dedup_info); - WRITE_UINT_FIELD(relid); - WRITE_ENUM_FIELD(rtekind, RTEKind); - WRITE_INT_FIELD(min_attr); - WRITE_INT_FIELD(max_attr); - WRITE_NODE_FIELD(indexlist); - WRITE_UINT_FIELD(pages); - WRITE_FLOAT_FIELD(tuples, "%.0f"); - WRITE_NODE_FIELD(subplan); - WRITE_NODE_FIELD(locationlist); - WRITE_STRING_FIELD(execcommand); - WRITE_CHAR_FIELD(fmttype); - WRITE_STRING_FIELD(fmtopts); - WRITE_INT_FIELD(rejectlimit); - WRITE_CHAR_FIELD(rejectlimittype); - WRITE_OID_FIELD(fmterrtbl); - WRITE_INT_FIELD(ext_encoding); - WRITE_BOOL_FIELD(isrescannable); - WRITE_BOOL_FIELD(writable); - WRITE_NODE_FIELD(baserestrictinfo); - WRITE_NODE_FIELD(joininfo); - WRITE_BITMAPSET_FIELD(index_outer_relids); - /* Skip writing Path ptrs to avoid endless recursion */ - /* WRITE_NODE_FIELD(index_inner_paths); */ -} - -static void -_outIndexOptInfo(StringInfo str, IndexOptInfo *node) -{ - - WRITE_NODE_TYPE("INDEXOPTINFO"); + WRITE_NODE_TYPE("INDEXOPTINFO"); /* NB: this isn't a complete set of fields */ WRITE_OID_FIELD(indexoid); @@ -1843,65 +663,6 @@ _outIndexOptInfo(StringInfo str, IndexOptInfo *node) WRITE_BOOL_FIELD(cdb_default_stats_used); } -static void -_outCdbRelDedupInfo(StringInfo str, CdbRelDedupInfo *node) -{ - WRITE_NODE_TYPE("CdbRelDedupInfo"); - - WRITE_BITMAPSET_FIELD(prejoin_dedup_subqrelids); - WRITE_BITMAPSET_FIELD(spent_subqrelids); - WRITE_BOOL_FIELD(try_postjoin_dedup); - WRITE_BOOL_FIELD(no_more_subqueries); - WRITE_NODE_FIELD(join_unique_ininfo); - /* Skip writing Path ptrs to avoid endless recursion */ - /* WRITE_NODE_FIELD(later_dedup_pathlist); */ - /* WRITE_NODE_FIELD(cheapest_startup_path); */ - /* WRITE_NODE_FIELD(cheapest_total_path); */ -} - -static void -_outPathKeyItem(StringInfo str, PathKeyItem *node) -{ - WRITE_NODE_TYPE("PATHKEYITEM"); - - WRITE_NODE_FIELD(key); - WRITE_OID_FIELD(sortop); -} - -static void -_outRestrictInfo(StringInfo str, RestrictInfo *node) -{ - WRITE_NODE_TYPE("RESTRICTINFO"); - - /* NB: this isn't a complete set of fields */ - WRITE_NODE_FIELD(clause); - WRITE_BOOL_FIELD(is_pushed_down); - WRITE_BOOL_FIELD(outerjoin_delayed); - WRITE_BOOL_FIELD(can_join); - WRITE_BOOL_FIELD(pseudoconstant); - WRITE_BITMAPSET_FIELD(clause_relids); - WRITE_BITMAPSET_FIELD(required_relids); - WRITE_BITMAPSET_FIELD(left_relids); - WRITE_BITMAPSET_FIELD(right_relids); - WRITE_NODE_FIELD(orclause); - WRITE_OID_FIELD(mergejoinoperator); - WRITE_OID_FIELD(left_sortop); - WRITE_OID_FIELD(right_sortop); - WRITE_NODE_FIELD(left_pathkey); - WRITE_NODE_FIELD(right_pathkey); - WRITE_OID_FIELD(hashjoinoperator); -} - -static void -_outInnerIndexscanInfo(StringInfo str, InnerIndexscanInfo *node) -{ - WRITE_NODE_TYPE("INNERINDEXSCANINFO"); - WRITE_BITMAPSET_FIELD(other_relids); - WRITE_BOOL_FIELD(isouterjoin); - WRITE_NODE_FIELD(cheapest_startup_innerpath); - WRITE_NODE_FIELD(cheapest_total_innerpath); -} - static void _outOuterJoinInfo(StringInfo str, OuterJoinInfo *node) { @@ -1913,30 +674,6 @@ _outOuterJoinInfo(StringInfo str, OuterJoinInfo *node) WRITE_BOOL_FIELD(lhs_strict); } -static void -_outInClauseInfo(StringInfo str, InClauseInfo *node) -{ - WRITE_NODE_TYPE("INCLAUSEINFO"); - - WRITE_BITMAPSET_FIELD(righthand); - WRITE_BOOL_FIELD(try_join_unique); /*CDB*/ - WRITE_NODE_FIELD(sub_targetlist); -} - -static void -_outAppendRelInfo(StringInfo str, AppendRelInfo *node) -{ - WRITE_NODE_TYPE("APPENDRELINFO"); - - WRITE_UINT_FIELD(parent_relid); - WRITE_UINT_FIELD(child_relid); - WRITE_OID_FIELD(parent_reltype); - WRITE_OID_FIELD(child_reltype); - WRITE_NODE_FIELD(col_mappings); - WRITE_NODE_FIELD(translated_vars); - WRITE_OID_FIELD(parent_reloid); -} - /***************************************************************************** * * Stuff from parsenodes.h. @@ -1986,31 +723,6 @@ _outCreateStmt(StringInfo str, CreateStmt *node) WRITE_NODE_FIELD(attr_encodings); } -static void -_outColumnReferenceStorageDirective(StringInfo str, ColumnReferenceStorageDirective *node) -{ - WRITE_NODE_TYPE("COLUMNREFERENCESTORAGEDIRECTIVE"); - - WRITE_NODE_FIELD(column); - WRITE_BOOL_FIELD(deflt); - WRITE_NODE_FIELD(encoding); -} - -static void -_outPartitionBy(StringInfo str, PartitionBy *node) -{ - WRITE_NODE_TYPE("PARTITIONBY"); - WRITE_ENUM_FIELD(partType, PartitionByType); - WRITE_NODE_FIELD(keys); - WRITE_NODE_FIELD(keyopclass); - WRITE_NODE_FIELD(partNum); - WRITE_NODE_FIELD(subPart); - WRITE_NODE_FIELD(partSpec); - WRITE_INT_FIELD(partDepth); - WRITE_INT_FIELD(partQuiet); - WRITE_INT_FIELD(location); -} - static void _outPartitionSpec(StringInfo str, PartitionSpec *node) { @@ -2022,30 +734,6 @@ _outPartitionSpec(StringInfo str, PartitionSpec *node) WRITE_NODE_FIELD(enc_clauses); } -static void -_outPartitionElem(StringInfo str, PartitionElem *node) -{ - WRITE_NODE_TYPE("PARTITIONELEM"); - WRITE_NODE_FIELD(partName); - WRITE_NODE_FIELD(boundSpec); - WRITE_NODE_FIELD(subSpec); - WRITE_BOOL_FIELD(isDefault); - WRITE_NODE_FIELD(storeAttr); - WRITE_INT_FIELD(partno); - WRITE_LONG_FIELD(rrand); - WRITE_NODE_FIELD(colencs); - WRITE_INT_FIELD(location); -} - -static void -_outPartitionRangeItem(StringInfo str, PartitionRangeItem *node) -{ - WRITE_NODE_TYPE("PARTITIONRANGEITEM"); - WRITE_NODE_FIELD(partRangeVal); - WRITE_ENUM_FIELD(partedge, PartitionEdgeBounding); - WRITE_INT_FIELD(location); -} - static void _outPartitionBoundSpec(StringInfo str, PartitionBoundSpec *node) { @@ -2056,14 +744,6 @@ _outPartitionBoundSpec(StringInfo str, PartitionBoundSpec *node) WRITE_INT_FIELD(location); } -static void -_outPartitionValuesSpec(StringInfo str, PartitionValuesSpec *node) -{ - WRITE_NODE_TYPE("PARTITIONVALUESSPEC"); - WRITE_NODE_FIELD(partValues); - WRITE_INT_FIELD(location); -} - static void _outPartition(StringInfo str, Partition *node) { @@ -2074,917 +754,64 @@ _outPartition(StringInfo str, Partition *node) WRITE_CHAR_FIELD(parkind); WRITE_INT_FIELD(parlevel); WRITE_BOOL_FIELD(paristemplate); - WRITE_BINARY_FIELD(parnatts, sizeof(int2)); - WRITE_INT_ARRAY(paratts, parnatts, int2); - WRITE_OID_ARRAY(parclass, parnatts); -} - -static void -_outPartitionRule(StringInfo str, PartitionRule *node) -{ - WRITE_NODE_TYPE("PARTITIONRULE"); - - WRITE_OID_FIELD(parruleid); - WRITE_OID_FIELD(paroid); - WRITE_OID_FIELD(parchildrelid); - WRITE_OID_FIELD(parparentoid); - WRITE_BOOL_FIELD(parisdefault); - WRITE_STRING_FIELD(parname); - WRITE_NODE_FIELD(parrangestart); - WRITE_BOOL_FIELD(parrangestartincl); - WRITE_NODE_FIELD(parrangeend); - WRITE_BOOL_FIELD(parrangeendincl); - WRITE_NODE_FIELD(parrangeevery); - WRITE_NODE_FIELD(parlistvalues); - WRITE_BINARY_FIELD(parruleord, sizeof(int2)); - WRITE_NODE_FIELD(parreloptions); - WRITE_OID_FIELD(partemplatespaceId); - WRITE_NODE_FIELD(children); -} - -static void -_outPartitionNode(StringInfo str, PartitionNode *node) -{ - WRITE_NODE_TYPE("PARTITIONNODE"); - - WRITE_NODE_FIELD(part); - WRITE_NODE_FIELD(default_part); - WRITE_NODE_FIELD(rules); -} - -static void -_outPgPartRule(StringInfo str, PgPartRule *node) -{ - WRITE_NODE_TYPE("PGPARTRULE"); - - WRITE_NODE_FIELD(pNode); - WRITE_NODE_FIELD(topRule); - WRITE_STRING_FIELD(partIdStr); - WRITE_BOOL_FIELD(isName); - WRITE_INT_FIELD(topRuleRank); - WRITE_STRING_FIELD(relname); -} - -static void -_outSegfileMapNode(StringInfo str, SegfileMapNode *node) -{ - WRITE_NODE_TYPE("SEGFILEMAPNODE"); - - WRITE_OID_FIELD(relid); - WRITE_INT_FIELD(segno); -} - -static void -_outExtTableTypeDesc(StringInfo str, ExtTableTypeDesc *node) -{ - WRITE_NODE_TYPE("EXTTABLETYPEDESC"); - - WRITE_ENUM_FIELD(exttabletype, ExtTableType); - WRITE_NODE_FIELD(location_list); - WRITE_NODE_FIELD(on_clause); - WRITE_STRING_FIELD(command_string); -} - -static void -_outCreateExternalStmt(StringInfo str, CreateExternalStmt *node) -{ - WRITE_NODE_TYPE("CREATEEXTERNALSTMT"); - - WRITE_NODE_FIELD(relation); - WRITE_NODE_FIELD(tableElts); - WRITE_NODE_FIELD(exttypedesc); - WRITE_STRING_FIELD(format); - WRITE_NODE_FIELD(formatOpts); - WRITE_BOOL_FIELD(isweb); - WRITE_BOOL_FIELD(iswritable); - WRITE_NODE_FIELD(sreh); - WRITE_NODE_FIELD(encoding); - WRITE_NODE_FIELD(distributedBy); - -} - -static void -_outCreateForeignStmt(StringInfo str, CreateForeignStmt *node) -{ - WRITE_NODE_TYPE("CREATEFOREIGNSTMT"); - - WRITE_NODE_FIELD(relation); - WRITE_NODE_FIELD(tableElts); - WRITE_STRING_FIELD(srvname); - WRITE_NODE_FIELD(options); -} - -static void -_outIndexStmt(StringInfo str, IndexStmt *node) -{ - WRITE_NODE_TYPE("INDEXSTMT"); - - WRITE_STRING_FIELD(idxname); - WRITE_NODE_FIELD(relation); - WRITE_STRING_FIELD(accessMethod); - WRITE_STRING_FIELD(tableSpace); - WRITE_NODE_FIELD(indexParams); - WRITE_NODE_FIELD(options); - - WRITE_NODE_FIELD(whereClause); - WRITE_NODE_FIELD(rangetable); - WRITE_BOOL_FIELD(is_part_child); - WRITE_BOOL_FIELD(unique); - WRITE_BOOL_FIELD(primary); - WRITE_BOOL_FIELD(isconstraint); - WRITE_STRING_FIELD(altconname); - WRITE_OID_FIELD(constrOid); - WRITE_BOOL_FIELD(concurrent); - WRITE_NODE_FIELD(idxOids); -} - -static void -_outReindexStmt(StringInfo str, ReindexStmt *node) -{ - WRITE_NODE_TYPE("REINDEXSTMT"); - - WRITE_ENUM_FIELD(kind,ObjectType); - WRITE_NODE_FIELD(relation); - WRITE_STRING_FIELD(name); - WRITE_BOOL_FIELD(do_system); - WRITE_BOOL_FIELD(do_user); - WRITE_NODE_FIELD(new_ind_oids); - WRITE_OID_FIELD(relid); -} - - -static void -_outViewStmt(StringInfo str, ViewStmt *node) -{ - WRITE_NODE_TYPE("VIEWSTMT"); - - WRITE_NODE_FIELD(view); - WRITE_NODE_FIELD(aliases); - WRITE_NODE_FIELD(query); - WRITE_BOOL_FIELD(replace); - WRITE_OID_FIELD(relOid); - WRITE_OID_FIELD(comptypeOid); - WRITE_OID_FIELD(rewriteOid); -} - -static void -_outRuleStmt(StringInfo str, RuleStmt *node) -{ - WRITE_NODE_TYPE("RULESTMT"); - - WRITE_NODE_FIELD(relation); - WRITE_STRING_FIELD(rulename); - WRITE_NODE_FIELD(whereClause); - WRITE_ENUM_FIELD(event,CmdType); - WRITE_BOOL_FIELD(instead); - WRITE_NODE_FIELD(actions); - WRITE_BOOL_FIELD(replace); - WRITE_OID_FIELD(ruleOid); -} - -static void -_outDropStmt(StringInfo str, DropStmt *node) -{ - WRITE_NODE_TYPE("DROPSTMT"); - - WRITE_NODE_FIELD(objects); - WRITE_ENUM_FIELD(removeType, ObjectType); - WRITE_ENUM_FIELD(behavior, DropBehavior); - WRITE_BOOL_FIELD(missing_ok); - WRITE_BOOL_FIELD(bAllowPartn); - - -} - -static void -_outDropPropertyStmt(StringInfo str, DropPropertyStmt *node) -{ - WRITE_NODE_TYPE("DROPPROPSTMT"); - - WRITE_NODE_FIELD(relation); - WRITE_STRING_FIELD(property); - WRITE_ENUM_FIELD(removeType, ObjectType); - WRITE_ENUM_FIELD(behavior, DropBehavior); - WRITE_BOOL_FIELD(missing_ok); - -} - -static void -_outDropOwnedStmt(StringInfo str, DropOwnedStmt *node) -{ - WRITE_NODE_TYPE("DROPOWNEDSTMT"); - - WRITE_NODE_FIELD(roles); - WRITE_ENUM_FIELD(behavior, DropBehavior); -} - -static void -_outReassignOwnedStmt(StringInfo str, ReassignOwnedStmt *node) -{ - WRITE_NODE_TYPE("REASSIGNOWNEDSTMT"); - - WRITE_NODE_FIELD(roles); - WRITE_STRING_FIELD(newrole) - -} - -static void -_outTruncateStmt(StringInfo str, TruncateStmt *node) -{ - WRITE_NODE_TYPE("TRUNCATESTMT"); - - WRITE_NODE_FIELD(relations); - WRITE_ENUM_FIELD(behavior, DropBehavior); - WRITE_NODE_FIELD(relids); - WRITE_NODE_FIELD(new_heap_oids); - WRITE_NODE_FIELD(new_toast_oids); - WRITE_NODE_FIELD(new_aoseg_oids); - WRITE_NODE_FIELD(new_aoblkdir_oids); - WRITE_NODE_FIELD(new_aovisimap_oids); - WRITE_NODE_FIELD(new_ind_oids); -} - -static void -_outAlterTableStmt(StringInfo str, AlterTableStmt *node) -{ - int m; - WRITE_NODE_TYPE("ALTERTABLESTMT"); - - WRITE_NODE_FIELD(relation); - WRITE_NODE_FIELD(cmds); - WRITE_ENUM_FIELD(relkind, ObjectType); - WRITE_NODE_FIELD(oidmap); - WRITE_INT_FIELD(oidInfoCount); - - for (m = 0; m < node->oidInfoCount; m++) - { - WRITE_OID_FIELD(oidInfo[m].relOid); - WRITE_OID_FIELD(oidInfo[m].comptypeOid); - WRITE_OID_FIELD(oidInfo[m].toastOid); - WRITE_OID_FIELD(oidInfo[m].toastIndexOid); - WRITE_OID_FIELD(oidInfo[m].toastComptypeOid); - WRITE_OID_FIELD(oidInfo[m].aosegOid); - WRITE_OID_FIELD(oidInfo[m].aosegIndexOid); - WRITE_OID_FIELD(oidInfo[m].aosegComptypeOid); - WRITE_OID_FIELD(oidInfo[m].aovisimapOid); - WRITE_OID_FIELD(oidInfo[m].aovisimapIndexOid); - WRITE_OID_FIELD(oidInfo[m].aovisimapComptypeOid); - WRITE_OID_FIELD(oidInfo[m].aoblkdirOid); - WRITE_OID_FIELD(oidInfo[m].aoblkdirIndexOid); - WRITE_OID_FIELD(oidInfo[m].aoblkdirComptypeOid); - } -} - -static void -_outAlterTableCmd(StringInfo str, AlterTableCmd *node) -{ - WRITE_NODE_TYPE("ALTERTABLECMD"); - - WRITE_ENUM_FIELD(subtype, AlterTableType); - WRITE_STRING_FIELD(name); - WRITE_NODE_FIELD(def); - WRITE_NODE_FIELD(transform); - WRITE_ENUM_FIELD(behavior, DropBehavior); - WRITE_BOOL_FIELD(part_expanded); - WRITE_NODE_FIELD(partoids); -} - -static void -_outInheritPartitionCmd(StringInfo str, InheritPartitionCmd *node) -{ - WRITE_NODE_TYPE("INHERITPARTITION"); - - WRITE_NODE_FIELD(parent); -} - -static void - -_outAlterPartitionCmd(StringInfo str, AlterPartitionCmd *node) -{ - WRITE_NODE_TYPE("ALTERPARTITIONCMD"); - - WRITE_NODE_FIELD(partid); - WRITE_NODE_FIELD(arg1); - WRITE_NODE_FIELD(arg2); - WRITE_LIST_FIELD(newOids); -} - -static void -_outAlterPartitionId(StringInfo str, AlterPartitionId *node) -{ - WRITE_NODE_TYPE("ALTERPARTITIONID"); - - WRITE_ENUM_FIELD(idtype, AlterPartitionIdType); - WRITE_NODE_FIELD(partiddef); -} - -static void -_outCreateRoleStmt(StringInfo str, CreateRoleStmt *node) -{ - WRITE_NODE_TYPE("CREATEROLESTMT"); - - WRITE_ENUM_FIELD(stmt_type, RoleStmtType); - WRITE_STRING_FIELD(role); - WRITE_NODE_FIELD(options); - WRITE_OID_FIELD(roleOid); -} - -static void -_outDenyLoginInterval(StringInfo str, DenyLoginInterval *node) -{ - WRITE_NODE_TYPE("DENYLOGININTERVAL"); - - WRITE_NODE_FIELD(start); - WRITE_NODE_FIELD(end); -} - -static void -_outDenyLoginPoint(StringInfo str, DenyLoginPoint *node) -{ - WRITE_NODE_TYPE("DENYLOGINPOINT"); - - WRITE_NODE_FIELD(day); - WRITE_NODE_FIELD(time); -} - -static void -_outDropRoleStmt(StringInfo str, DropRoleStmt *node) -{ - WRITE_NODE_TYPE("DROPROLESTMT"); - - WRITE_NODE_FIELD(roles); - WRITE_BOOL_FIELD(missing_ok); -} - -static void -_outAlterRoleStmt(StringInfo str, AlterRoleStmt *node) -{ - WRITE_NODE_TYPE("ALTERROLESTMT"); - - WRITE_STRING_FIELD(role); - WRITE_NODE_FIELD(options); - WRITE_INT_FIELD(action); -} - -static void -_outAlterRoleSetStmt(StringInfo str, AlterRoleSetStmt *node) -{ - WRITE_NODE_TYPE("ALTERROLESETSTMT"); - - WRITE_STRING_FIELD(role); - WRITE_STRING_FIELD(variable); - WRITE_NODE_FIELD(value); -} - - -static void -_outAlterOwnerStmt(StringInfo str, AlterOwnerStmt *node) -{ - WRITE_NODE_TYPE("ALTEROWNERSTMT"); - - WRITE_ENUM_FIELD(objectType,ObjectType); - WRITE_NODE_FIELD(relation); - WRITE_NODE_FIELD(object); - WRITE_NODE_FIELD(objarg); - WRITE_STRING_FIELD(addname); - WRITE_STRING_FIELD(newowner); - -} - - -static void -_outRenameStmt(StringInfo str, RenameStmt *node) -{ - WRITE_NODE_TYPE("RENAMESTMT"); - - WRITE_NODE_FIELD(relation); - WRITE_OID_FIELD(objid); - WRITE_NODE_FIELD(object); - WRITE_NODE_FIELD(objarg); - WRITE_STRING_FIELD(subname); - WRITE_STRING_FIELD(newname); - WRITE_ENUM_FIELD(renameType,ObjectType); - WRITE_BOOL_FIELD(bAllowPartn); - -} - -static void -_outAlterObjectSchemaStmt(StringInfo str, AlterObjectSchemaStmt *node) -{ - WRITE_NODE_TYPE("ALTEROBJECTSCHEMASTMT"); - - WRITE_NODE_FIELD(relation); - WRITE_NODE_FIELD(object); - WRITE_NODE_FIELD(objarg); - WRITE_STRING_FIELD(addname); - WRITE_STRING_FIELD(newschema); - WRITE_ENUM_FIELD(objectType,ObjectType); -} - -static void -_outCreateSeqStmt(StringInfo str, CreateSeqStmt *node) -{ - WRITE_NODE_TYPE("CREATESEQSTMT"); - WRITE_NODE_FIELD(sequence); - WRITE_NODE_FIELD(options); - WRITE_OID_FIELD(relOid); - WRITE_OID_FIELD(comptypeOid); -} - -static void -_outAlterSeqStmt(StringInfo str, AlterSeqStmt *node) -{ - WRITE_NODE_TYPE("ALTERSEQSTMT"); - WRITE_NODE_FIELD(sequence); - WRITE_NODE_FIELD(options); -} - -static void -_outClusterStmt(StringInfo str, ClusterStmt *node) -{ - WRITE_NODE_TYPE("CLUSTERSTMT"); - - WRITE_NODE_FIELD(relation); - WRITE_STRING_FIELD(indexname); - WRITE_OID_FIELD(oidInfo.relOid); - WRITE_OID_FIELD(oidInfo.comptypeOid); - WRITE_OID_FIELD(oidInfo.toastOid); - WRITE_OID_FIELD(oidInfo.toastIndexOid); - WRITE_OID_FIELD(oidInfo.toastComptypeOid); - WRITE_OID_FIELD(oidInfo.aosegOid); - WRITE_OID_FIELD(oidInfo.aosegIndexOid); - WRITE_OID_FIELD(oidInfo.aosegComptypeOid); - WRITE_OID_FIELD(oidInfo.aovisimapOid); - WRITE_OID_FIELD(oidInfo.aovisimapIndexOid); - WRITE_OID_FIELD(oidInfo.aovisimapComptypeOid); - WRITE_OID_FIELD(oidInfo.aoblkdirOid); - WRITE_OID_FIELD(oidInfo.aoblkdirIndexOid); - WRITE_OID_FIELD(oidInfo.aoblkdirComptypeOid); - WRITE_NODE_FIELD(new_ind_oids); -} - -static void -_outCreatedbStmt(StringInfo str, CreatedbStmt *node) -{ - WRITE_NODE_TYPE("CREATEDBSTMT"); - WRITE_STRING_FIELD(dbname); - WRITE_NODE_FIELD(options); - WRITE_OID_FIELD(dbOid); -} - -static void -_outDropdbStmt(StringInfo str, DropdbStmt *node) -{ - WRITE_NODE_TYPE("DROPDBSTMT"); - WRITE_STRING_FIELD(dbname); - WRITE_BOOL_FIELD(missing_ok); -} - -static void -_outCreateDomainStmt(StringInfo str, CreateDomainStmt *node) -{ - WRITE_NODE_TYPE("CREATEDOMAINSTMT"); - WRITE_NODE_FIELD(domainname); - WRITE_NODE_FIELD(typname); - WRITE_NODE_FIELD(constraints); - WRITE_OID_FIELD(domainOid); -} - -static void -_outAlterDomainStmt(StringInfo str, AlterDomainStmt *node) -{ - WRITE_NODE_TYPE("ALTERDOMAINSTMT"); - WRITE_CHAR_FIELD(subtype); - WRITE_NODE_FIELD(typname); - WRITE_STRING_FIELD(name); - WRITE_NODE_FIELD(def); - WRITE_ENUM_FIELD(behavior, DropBehavior); -} - -static void -_outCreateFdwStmt(StringInfo str, CreateFdwStmt *node) -{ - WRITE_NODE_TYPE("CREATEFDWSTMT"); - WRITE_STRING_FIELD(fdwname); - WRITE_NODE_FIELD(validator); - WRITE_NODE_FIELD(options); -} - -static void -_outAlterFdwStmt(StringInfo str, AlterFdwStmt *node) -{ - WRITE_NODE_TYPE("ALTERFDWSTMT"); - WRITE_STRING_FIELD(fdwname); - WRITE_NODE_FIELD(validator); - WRITE_BOOL_FIELD(change_validator); - WRITE_NODE_FIELD(options); -} - -static void -_outDropFdwStmt(StringInfo str, DropFdwStmt *node) -{ - WRITE_NODE_TYPE("DROPFDWSTMT"); - WRITE_STRING_FIELD(fdwname); - WRITE_BOOL_FIELD(missing_ok); - WRITE_ENUM_FIELD(behavior, DropBehavior); -} - -static void -_outCreateForeignServerStmt(StringInfo str, CreateForeignServerStmt *node) -{ - WRITE_NODE_TYPE("CREATEFOREIGNSERVERSTMT"); - WRITE_STRING_FIELD(servername); - WRITE_STRING_FIELD(servertype); - WRITE_STRING_FIELD(version); - WRITE_STRING_FIELD(fdwname); - WRITE_NODE_FIELD(options); -} - -static void -_outAlterForeignServerStmt(StringInfo str, AlterForeignServerStmt *node) -{ - WRITE_NODE_TYPE("ALTERFOREIGNSERVERSTMT"); - WRITE_STRING_FIELD(servername); - WRITE_STRING_FIELD(version); - WRITE_NODE_FIELD(options); - WRITE_BOOL_FIELD(has_version); -} - -static void -_outDropForeignServerStmt(StringInfo str, DropForeignServerStmt *node) -{ - WRITE_NODE_TYPE("DROPFOREIGNSERVERSTMT"); - WRITE_STRING_FIELD(servername); - WRITE_BOOL_FIELD(missing_ok); - WRITE_ENUM_FIELD(behavior, DropBehavior); -} - -static void -_outCreateUserMappingStmt(StringInfo str, CreateUserMappingStmt *node) -{ - WRITE_NODE_TYPE("CREATEUSERMAPPINGSTMT"); - WRITE_STRING_FIELD(username); - WRITE_STRING_FIELD(servername); - WRITE_NODE_FIELD(options); -} - -static void -_outAlterUserMappingStmt(StringInfo str, AlterUserMappingStmt *node) -{ - WRITE_NODE_TYPE("ALTERUSERMAPPINGSTMT"); - WRITE_STRING_FIELD(username); - WRITE_STRING_FIELD(servername); - WRITE_NODE_FIELD(options); -} - -static void -_outDropUserMappingStmt(StringInfo str, DropUserMappingStmt *node) -{ - WRITE_NODE_TYPE("DROPUSERMAPPINGSTMT"); - WRITE_STRING_FIELD(username); - WRITE_STRING_FIELD(servername); - WRITE_BOOL_FIELD(missing_ok); -} - -static void -_outCreateFunctionStmt(StringInfo str, CreateFunctionStmt *node) -{ - WRITE_NODE_TYPE("CREATEFUNCSTMT"); - WRITE_BOOL_FIELD(replace); - WRITE_NODE_FIELD(funcname); - WRITE_NODE_FIELD(parameters); - WRITE_NODE_FIELD(returnType); - WRITE_NODE_FIELD(options); - WRITE_NODE_FIELD(withClause); - WRITE_OID_FIELD(funcOid); - WRITE_OID_FIELD(shelltypeOid); -} - -static void -_outFunctionParameter(StringInfo str, FunctionParameter *node) -{ - WRITE_NODE_TYPE("FUNCTIONPARAMETER"); - WRITE_STRING_FIELD(name); - WRITE_NODE_FIELD(argType); - WRITE_ENUM_FIELD(mode, FunctionParameterMode); - -} - -static void -_outRemoveFuncStmt(StringInfo str, RemoveFuncStmt *node) -{ - WRITE_NODE_TYPE("REMOVEFUNCSTMT"); - WRITE_ENUM_FIELD(kind,ObjectType); - WRITE_NODE_FIELD(name); - WRITE_NODE_FIELD(args); - WRITE_ENUM_FIELD(behavior, DropBehavior); - WRITE_BOOL_FIELD(missing_ok); -} - -static void -_outAlterFunctionStmt(StringInfo str, AlterFunctionStmt *node) -{ - WRITE_NODE_TYPE("ALTERFUNCTIONSTMT"); - WRITE_NODE_FIELD(func); - WRITE_NODE_FIELD(actions); -} - - - - - -static void -_outDefineStmt(StringInfo str, DefineStmt *node) -{ - WRITE_NODE_TYPE("DEFINESTMT"); - WRITE_ENUM_FIELD(kind, ObjectType); - WRITE_BOOL_FIELD(oldstyle); - WRITE_NODE_FIELD(defnames); - WRITE_NODE_FIELD(args); - WRITE_NODE_FIELD(definition); - WRITE_OID_FIELD(newOid); - WRITE_OID_FIELD(shadowOid); - WRITE_BOOL_FIELD(ordered); /* CDB */ - WRITE_BOOL_FIELD(trusted); /* CDB */ -} - -static void -_outCompositeTypeStmt(StringInfo str, CompositeTypeStmt *node) -{ - WRITE_NODE_TYPE("COMPTYPESTMT"); - - WRITE_NODE_FIELD(typevar); - WRITE_NODE_FIELD(coldeflist); - WRITE_OID_FIELD(relOid); - WRITE_OID_FIELD(comptypeOid); - -} - -static void -_outCreateCastStmt(StringInfo str, CreateCastStmt *node) -{ - WRITE_NODE_TYPE("CREATECAST"); - WRITE_NODE_FIELD(sourcetype); - WRITE_NODE_FIELD(targettype); - WRITE_NODE_FIELD(func); - WRITE_ENUM_FIELD(context, CoercionContext); - WRITE_OID_FIELD(castOid); -} - -static void -_outDropCastStmt(StringInfo str, DropCastStmt *node) -{ - WRITE_NODE_TYPE("DROPCAST"); - WRITE_NODE_FIELD(sourcetype); - WRITE_NODE_FIELD(targettype); - WRITE_ENUM_FIELD(behavior, DropBehavior); - WRITE_BOOL_FIELD(missing_ok); -} - -static void -_outCreateOpClassStmt(StringInfo str, CreateOpClassStmt *node) -{ - WRITE_NODE_TYPE("CREATEOPCLASS"); - WRITE_NODE_FIELD(opclassname); - WRITE_STRING_FIELD(amname); - WRITE_NODE_FIELD(datatype); - WRITE_NODE_FIELD(items); - WRITE_BOOL_FIELD(isDefault); - WRITE_OID_FIELD(opclassOid); -} - -static void -_outCreateOpClassItem(StringInfo str, CreateOpClassItem *node) -{ - WRITE_NODE_TYPE("CREATEOPCLASSITEM"); - WRITE_INT_FIELD(itemtype); - WRITE_NODE_FIELD(name); - WRITE_NODE_FIELD(args); - WRITE_INT_FIELD(number); - WRITE_BOOL_FIELD(recheck); - WRITE_NODE_FIELD(storedtype); -} - -static void -_outRemoveOpClassStmt(StringInfo str, RemoveOpClassStmt *node) -{ - WRITE_NODE_TYPE("REMOVEOPCLASS"); - WRITE_NODE_FIELD(opclassname); - WRITE_STRING_FIELD(amname); - WRITE_ENUM_FIELD(behavior, DropBehavior); - WRITE_BOOL_FIELD(missing_ok); -} - -static void -_outCreateConversionStmt(StringInfo str, CreateConversionStmt *node) -{ - WRITE_NODE_TYPE("CREATECONVERSION"); - WRITE_NODE_FIELD(conversion_name); - WRITE_STRING_FIELD(for_encoding_name); - WRITE_STRING_FIELD(to_encoding_name); - WRITE_NODE_FIELD(func_name); - WRITE_BOOL_FIELD(def); - WRITE_OID_FIELD(convOid); -} - -static void -_outTransactionStmt(StringInfo str, TransactionStmt *node) -{ - WRITE_NODE_TYPE("TRANSACTIONSTMT"); - - WRITE_ENUM_FIELD(kind, TransactionStmtKind); - WRITE_NODE_FIELD(options); - -} - -static void -_outNotifyStmt(StringInfo str, NotifyStmt *node) -{ - WRITE_NODE_TYPE("NOTIFY"); - - WRITE_NODE_FIELD(relation); -} - -static void -_outDeclareCursorStmt(StringInfo str, DeclareCursorStmt *node) -{ - WRITE_NODE_TYPE("DECLARECURSOR"); - - WRITE_STRING_FIELD(portalname); - WRITE_INT_FIELD(options); - WRITE_NODE_FIELD(query); - WRITE_BOOL_FIELD(is_simply_updatable); -} - -static void -_outSingleRowErrorDesc(StringInfo str, SingleRowErrorDesc *node) -{ - WRITE_NODE_TYPE("SINGLEROWERRORDESC"); - WRITE_NODE_FIELD(errtable); - WRITE_INT_FIELD(rejectlimit); - WRITE_BOOL_FIELD(is_keep); - WRITE_BOOL_FIELD(is_limit_in_rows); - WRITE_BOOL_FIELD(reusing_existing_errtable); - WRITE_BOOL_FIELD(into_file); -} - -static void -_outCopyStmt(StringInfo str, CopyStmt *node) -{ - WRITE_NODE_TYPE("COPYSTMT"); - WRITE_NODE_FIELD(relation); - WRITE_NODE_FIELD(attlist); - WRITE_BOOL_FIELD(is_from); - WRITE_BOOL_FIELD(skip_ext_partition); - WRITE_STRING_FIELD(filename); - WRITE_NODE_FIELD(options); - WRITE_NODE_FIELD(sreh); - WRITE_NODE_FIELD(partitions); - WRITE_NODE_FIELD(ao_segnos); -} - - -static void -_outGrantStmt(StringInfo str, GrantStmt *node) -{ - WRITE_NODE_TYPE("GRANTSTMT"); - WRITE_BOOL_FIELD(is_grant); - WRITE_ENUM_FIELD(objtype,GrantObjectType); - WRITE_NODE_FIELD(objects); - WRITE_NODE_FIELD(privileges); - WRITE_NODE_FIELD(grantees); - WRITE_BOOL_FIELD(grant_option); - WRITE_ENUM_FIELD(behavior, DropBehavior); - WRITE_NODE_FIELD(cooked_privs); -} - -static void -_outPrivGrantee(StringInfo str, PrivGrantee *node) -{ - WRITE_NODE_TYPE("PRIVGRANTEE"); - WRITE_STRING_FIELD(rolname); -} - -static void -_outFuncWithArgs(StringInfo str, FuncWithArgs *node) -{ - WRITE_NODE_TYPE("FUNCWITHARGS"); - WRITE_NODE_FIELD(funcname); - WRITE_NODE_FIELD(funcargs); -} - -static void -_outGrantRoleStmt(StringInfo str, GrantRoleStmt *node) -{ - WRITE_NODE_TYPE("GRANTROLESTMT"); - WRITE_NODE_FIELD(granted_roles); - WRITE_NODE_FIELD(grantee_roles); - WRITE_BOOL_FIELD(is_grant); - WRITE_BOOL_FIELD(admin_opt); - WRITE_STRING_FIELD(grantor); - WRITE_ENUM_FIELD(behavior, DropBehavior); -} - -static void -_outLockStmt(StringInfo str, LockStmt *node) -{ - WRITE_NODE_TYPE("LOCKSTMT"); - WRITE_NODE_FIELD(relations); - WRITE_INT_FIELD(mode); - WRITE_BOOL_FIELD(nowait); -} - -static void -_outConstraintsSetStmt(StringInfo str, ConstraintsSetStmt *node) -{ - WRITE_NODE_TYPE("CONSTRAINTSSETSTMT"); - WRITE_NODE_FIELD(constraints); - WRITE_BOOL_FIELD(deferred); -} - -static void -_outFuncCall(StringInfo str, FuncCall *node) -{ - WRITE_NODE_TYPE("FUNCCALL"); - - WRITE_NODE_FIELD(funcname); - WRITE_NODE_FIELD(args); - WRITE_NODE_FIELD(agg_order); - WRITE_BOOL_FIELD(agg_star); - WRITE_BOOL_FIELD(agg_distinct); - WRITE_NODE_FIELD(over); - WRITE_INT_FIELD(location); - WRITE_NODE_FIELD(agg_filter); -} - -static void -_outDefElem(StringInfo str, DefElem *node) -{ - WRITE_NODE_TYPE("DEFELEM"); - - WRITE_STRING_FIELD(defname); - WRITE_NODE_FIELD(arg); - WRITE_ENUM_FIELD(defaction, DefElemAction); -} - -static void -_outLockingClause(StringInfo str, LockingClause *node) -{ - WRITE_NODE_TYPE("LOCKINGCLAUSE"); - - WRITE_NODE_FIELD(lockedRels); - WRITE_BOOL_FIELD(forUpdate); - WRITE_BOOL_FIELD(noWait); -} - -static void -_outDMLActionExpr(StringInfo str, DMLActionExpr *node) -{ - WRITE_NODE_TYPE("DMLACTIONEXPR"); -} - -static void -_outPartOidExpr(StringInfo str, PartOidExpr *node) -{ - WRITE_NODE_TYPE("PARTOIDEXPR"); - - WRITE_INT_FIELD(level); + WRITE_BINARY_FIELD(parnatts, sizeof(int2)); + WRITE_INT_ARRAY(paratts, parnatts, int2); + WRITE_OID_ARRAY(parclass, parnatts); } static void -_outPartDefaultExpr(StringInfo str, PartDefaultExpr *node) +_outPartitionRule(StringInfo str, PartitionRule *node) { - WRITE_NODE_TYPE("PARTDEFAULTEXPR"); + WRITE_NODE_TYPE("PARTITIONRULE"); - WRITE_INT_FIELD(level); + WRITE_OID_FIELD(parruleid); + WRITE_OID_FIELD(paroid); + WRITE_OID_FIELD(parchildrelid); + WRITE_OID_FIELD(parparentoid); + WRITE_BOOL_FIELD(parisdefault); + WRITE_STRING_FIELD(parname); + WRITE_NODE_FIELD(parrangestart); + WRITE_BOOL_FIELD(parrangestartincl); + WRITE_NODE_FIELD(parrangeend); + WRITE_BOOL_FIELD(parrangeendincl); + WRITE_NODE_FIELD(parrangeevery); + WRITE_NODE_FIELD(parlistvalues); + WRITE_BINARY_FIELD(parruleord, sizeof(int2)); + WRITE_NODE_FIELD(parreloptions); + WRITE_OID_FIELD(partemplatespaceId); + WRITE_NODE_FIELD(children); } static void -_outPartBoundExpr(StringInfo str, PartBoundExpr *node) +_outAlterPartitionCmd(StringInfo str, AlterPartitionCmd *node) { - WRITE_NODE_TYPE("PARTBOUNDEXPR"); + WRITE_NODE_TYPE("ALTERPARTITIONCMD"); - WRITE_INT_FIELD(level); - WRITE_OID_FIELD(boundType); - WRITE_BOOL_FIELD(isLowerBound); + WRITE_NODE_FIELD(partid); + WRITE_NODE_FIELD(arg1); + WRITE_NODE_FIELD(arg2); + WRITE_NODE_FIELD(newOids); } static void -_outPartBoundInclusionExpr(StringInfo str, PartBoundInclusionExpr *node) +_outCreateDomainStmt(StringInfo str, CreateDomainStmt *node) { - WRITE_NODE_TYPE("PARTBOUNDOPENEXPR"); - - WRITE_INT_FIELD(level); - WRITE_BOOL_FIELD(isLowerBound); + WRITE_NODE_TYPE("CREATEDOMAINSTMT"); + WRITE_NODE_FIELD(domainname); + WRITE_NODE_FIELD(typname); + WRITE_NODE_FIELD(constraints); + WRITE_OID_FIELD(domainOid); } static void -_outPartBoundOpenExpr(StringInfo str, PartBoundOpenExpr *node) +_outAlterDomainStmt(StringInfo str, AlterDomainStmt *node) { - WRITE_NODE_TYPE("PARTBOUNDINCLUSIONEXPR"); - - WRITE_INT_FIELD(level); - WRITE_BOOL_FIELD(isLowerBound); + WRITE_NODE_TYPE("ALTERDOMAINSTMT"); + WRITE_CHAR_FIELD(subtype); + WRITE_NODE_FIELD(typname); + WRITE_STRING_FIELD(name); + WRITE_NODE_FIELD(def); + WRITE_ENUM_FIELD(behavior, DropBehavior); } static void @@ -3030,23 +857,6 @@ _outTypeCast(StringInfo str, TypeCast *node) WRITE_NODE_FIELD(typname); } -static void -_outIndexElem(StringInfo str, IndexElem *node) -{ - WRITE_NODE_TYPE("INDEXELEM"); - - WRITE_STRING_FIELD(name); - WRITE_NODE_FIELD(expr); - WRITE_NODE_FIELD(opclass); -} - -static void -_outVariableResetStmt(StringInfo str, VariableResetStmt *node) -{ - WRITE_NODE_TYPE("VARIABLERESETSTMT"); - WRITE_STRING_FIELD(name); -} - static void _outQuery(StringInfo str, Query *node) { @@ -3086,161 +896,6 @@ _outQuery(StringInfo str, Query *node) /* Don't serialize policy */ } -static void -_outSortClause(StringInfo str, SortClause *node) -{ - WRITE_NODE_TYPE("SORTCLAUSE"); - - WRITE_UINT_FIELD(tleSortGroupRef); - WRITE_OID_FIELD(sortop); -} - -static void -_outGroupClause(StringInfo str, GroupClause *node) -{ - WRITE_NODE_TYPE("GROUPCLAUSE"); - - WRITE_UINT_FIELD(tleSortGroupRef); - WRITE_OID_FIELD(sortop); -} - -static void -_outGroupingClause(StringInfo str, GroupingClause *node) -{ - WRITE_NODE_TYPE("GROUPINGCLAUSE"); - - WRITE_ENUM_FIELD(groupType, GroupingType); - WRITE_NODE_FIELD(groupsets); -} - -static void -_outGroupingFunc(StringInfo str, GroupingFunc *node) -{ - WRITE_NODE_TYPE("GROUPINGFUNC"); - - WRITE_NODE_FIELD(args); - WRITE_INT_FIELD(ngrpcols); -} - -static void -_outGrouping(StringInfo str, Grouping *node) -{ - WRITE_NODE_TYPE("GROUPING"); -} - -static void -_outGroupId(StringInfo str, GroupId *node) -{ - WRITE_NODE_TYPE("GROUPID"); -} - -static void -_outWindowSpecParse(StringInfo str, WindowSpecParse *node) -{ - WRITE_NODE_TYPE("WINDOWSPECPARSE"); - - WRITE_STRING_FIELD(name); - WRITE_NODE_FIELD(elems); -} - -static void -_outWindowSpec(StringInfo str, WindowSpec *node) -{ - WRITE_NODE_TYPE("WINDOWSPEC"); - - WRITE_STRING_FIELD(name); - WRITE_STRING_FIELD(parent); - WRITE_NODE_FIELD(partition); - WRITE_NODE_FIELD(order); - WRITE_NODE_FIELD(frame); - WRITE_INT_FIELD(location); -} - -static void -_outWindowFrame(StringInfo str, WindowFrame *node) -{ - WRITE_NODE_TYPE("WINDOWFRAME"); - - WRITE_BOOL_FIELD(is_rows); - WRITE_BOOL_FIELD(is_between); - WRITE_NODE_FIELD(trail); - WRITE_NODE_FIELD(lead); - WRITE_ENUM_FIELD(exclude, WindowExclusion); -} - -static void -_outWindowFrameEdge(StringInfo str, WindowFrameEdge *node) -{ - WRITE_NODE_TYPE("WINDOWFRAMEEDGE"); - - WRITE_ENUM_FIELD(kind, WindowBoundingKind); - WRITE_NODE_FIELD(val); -} - -static void -_outPercentileExpr(StringInfo str, PercentileExpr *node) -{ - WRITE_NODE_TYPE("PERCENTILEEXPR"); - - WRITE_OID_FIELD(perctype); - WRITE_NODE_FIELD(args); - WRITE_ENUM_FIELD(perckind, PercKind); - WRITE_NODE_FIELD(sortClause); - WRITE_NODE_FIELD(sortTargets); - WRITE_NODE_FIELD(pcExpr); - WRITE_NODE_FIELD(tcExpr); - WRITE_INT_FIELD(location); -} - -static void -_outRowMarkClause(StringInfo str, RowMarkClause *node) -{ - WRITE_NODE_TYPE("ROWMARKCLAUSE"); - - WRITE_UINT_FIELD(rti); - WRITE_BOOL_FIELD(forUpdate); - WRITE_BOOL_FIELD(noWait); -} - -static void -_outWithClause(StringInfo str, WithClause *node) -{ - WRITE_NODE_TYPE("WITHCLAUSE"); - - WRITE_NODE_FIELD(ctes); - WRITE_BOOL_FIELD(recursive); - WRITE_INT_FIELD(location); -} - -static void -_outCommonTableExpr(StringInfo str, CommonTableExpr *node) -{ - WRITE_NODE_TYPE("COMMONTABLEEXPR"); - - WRITE_STRING_FIELD(ctename); - WRITE_NODE_FIELD(aliascolnames); - WRITE_NODE_FIELD(ctequery); - WRITE_INT_FIELD(location); - WRITE_BOOL_FIELD(cterecursive); - WRITE_INT_FIELD(cterefcount); - WRITE_NODE_FIELD(ctecolnames); - WRITE_NODE_FIELD(ctecoltypes); - WRITE_NODE_FIELD(ctecoltypmods); -} - -static void -_outSetOperationStmt(StringInfo str, SetOperationStmt *node) -{ - WRITE_NODE_TYPE("SETOPERATIONSTMT"); - - WRITE_ENUM_FIELD(op, SetOperation); - WRITE_BOOL_FIELD(all); - WRITE_NODE_FIELD(larg); - WRITE_NODE_FIELD(rarg); - WRITE_NODE_FIELD(colTypes); - WRITE_NODE_FIELD(colTypmods); -} - static void _outRangeTblEntry(StringInfo str, RangeTblEntry *node) { @@ -3388,24 +1043,6 @@ _outValue(StringInfo str, Value *value) } } -static void -_outColumnRef(StringInfo str, ColumnRef *node) -{ - WRITE_NODE_TYPE("COLUMNREF"); - - WRITE_NODE_FIELD(fields); - WRITE_INT_FIELD(location); -} - -static void -_outParamRef(StringInfo str, ParamRef *node) -{ - WRITE_NODE_TYPE("PARAMREF"); - - WRITE_INT_FIELD(number); - WRITE_INT_FIELD(location); /*CDB*/ -} - static void _outAConst(StringInfo str, A_Const *node) { @@ -3417,35 +1054,6 @@ _outAConst(StringInfo str, A_Const *node) } -static void -_outA_Indices(StringInfo str, A_Indices *node) -{ - WRITE_NODE_TYPE("A_INDICES"); - - WRITE_NODE_FIELD(lidx); - WRITE_NODE_FIELD(uidx); -} - -static void -_outA_Indirection(StringInfo str, A_Indirection *node) -{ - WRITE_NODE_TYPE("A_INDIRECTION"); - - WRITE_NODE_FIELD(arg); - WRITE_NODE_FIELD(indirection); -} - -static void -_outResTarget(StringInfo str, ResTarget *node) -{ - WRITE_NODE_TYPE("RESTARGET"); - - WRITE_STRING_FIELD(name); - WRITE_NODE_FIELD(indirection); - WRITE_NODE_FIELD(val); - WRITE_INT_FIELD(location); -} - static void _outConstraint(StringInfo str, Constraint *node) { @@ -3485,183 +1093,6 @@ _outConstraint(StringInfo str, Constraint *node) } } -static void -_outFkConstraint(StringInfo str, FkConstraint *node) -{ - WRITE_NODE_TYPE("FKCONSTRAINT"); - - WRITE_STRING_FIELD(constr_name); - WRITE_OID_FIELD(constrOid); - WRITE_NODE_FIELD(pktable); - WRITE_NODE_FIELD(fk_attrs); - WRITE_NODE_FIELD(pk_attrs); - WRITE_CHAR_FIELD(fk_matchtype); - WRITE_CHAR_FIELD(fk_upd_action); - WRITE_CHAR_FIELD(fk_del_action); - WRITE_BOOL_FIELD(deferrable); - WRITE_BOOL_FIELD(initdeferred); - WRITE_BOOL_FIELD(skip_validation); - WRITE_OID_FIELD(trig1Oid); - WRITE_OID_FIELD(trig2Oid); - WRITE_OID_FIELD(trig3Oid); - WRITE_OID_FIELD(trig4Oid); -} - -static void -_outCreateSchemaStmt(StringInfo str, CreateSchemaStmt *node) -{ - WRITE_NODE_TYPE("CREATESCHEMASTMT"); - - WRITE_STRING_FIELD(schemaname); - WRITE_STRING_FIELD(authid); - WRITE_BOOL_FIELD(istemp); - WRITE_OID_FIELD(schemaOid); - -} - -static void -_outCreatePLangStmt(StringInfo str, CreatePLangStmt *node) -{ - WRITE_NODE_TYPE("CREATEPLANGSTMT"); - - WRITE_STRING_FIELD(plname); - WRITE_NODE_FIELD(plhandler); - WRITE_NODE_FIELD(plvalidator); - WRITE_BOOL_FIELD(pltrusted); - WRITE_OID_FIELD(plangOid); - WRITE_OID_FIELD(plhandlerOid); - WRITE_OID_FIELD(plvalidatorOid); - -} - -static void -_outDropPLangStmt(StringInfo str, DropPLangStmt *node) -{ - WRITE_NODE_TYPE("DROPPLANGSTMT"); - - WRITE_STRING_FIELD(plname); - WRITE_ENUM_FIELD(behavior,DropBehavior); - WRITE_BOOL_FIELD(missing_ok); - -} - -static void -_outVacuumStmt(StringInfo str, VacuumStmt *node) -{ - WRITE_NODE_TYPE("VACUUMSTMT"); - - WRITE_BOOL_FIELD(vacuum); - WRITE_BOOL_FIELD(full); - WRITE_BOOL_FIELD(analyze); - WRITE_BOOL_FIELD(verbose); - WRITE_BOOL_FIELD(rootonly); - WRITE_INT_FIELD(freeze_min_age); - WRITE_NODE_FIELD(relation); - WRITE_NODE_FIELD(va_cols); - WRITE_NODE_FIELD(expanded_relids); - WRITE_NODE_FIELD(extra_oids); - WRITE_NODE_FIELD(appendonly_compaction_segno); - WRITE_NODE_FIELD(appendonly_compaction_insert_segno); - WRITE_BOOL_FIELD(appendonly_compaction_vacuum_cleanup); - WRITE_BOOL_FIELD(appendonly_compaction_vacuum_prepare); - WRITE_BOOL_FIELD(heap_truncate); -} - - -static void -_outCdbProcess(StringInfo str, CdbProcess *node) -{ - WRITE_NODE_TYPE("CDBPROCESS"); - WRITE_STRING_FIELD(listenerAddr); - WRITE_INT_FIELD(listenerPort); - WRITE_INT_FIELD(pid); - WRITE_INT_FIELD(contentid); -} - -static void -_outSlice(StringInfo str, Slice *node) -{ - WRITE_NODE_TYPE("SLICE"); - WRITE_INT_FIELD(sliceIndex); - WRITE_INT_FIELD(rootIndex); - WRITE_ENUM_FIELD(gangType,GangType); - WRITE_INT_FIELD(gangSize); - WRITE_INT_FIELD(numGangMembersToBeActive); - WRITE_BOOL_FIELD(directDispatch.isDirectDispatch); - WRITE_NODE_FIELD(directDispatch.contentIds); /* List of int */ - WRITE_DUMMY_FIELD(primaryGang); - WRITE_INT_FIELD(primary_gang_id); - WRITE_INT_FIELD(parentIndex); /* List of int index */ - WRITE_NODE_FIELD(children); /* List of int index */ - WRITE_NODE_FIELD(primaryProcesses); /* List of (CDBProcess *) */ -} - -static void -_outSliceTable(StringInfo str, SliceTable *node) -{ - WRITE_NODE_TYPE("SLICETABLE"); - WRITE_INT_FIELD(nMotions); - WRITE_INT_FIELD(nInitPlans); - WRITE_INT_FIELD(localSlice); - WRITE_NODE_FIELD(slices); /* List of int */ - WRITE_BOOL_FIELD(doInstrument); - WRITE_INT_FIELD(ic_instance_id); -} - - -static void -_outCreateTrigStmt(StringInfo str, CreateTrigStmt *node) -{ - WRITE_NODE_TYPE("CREATETRIGSTMT"); - - WRITE_STRING_FIELD(trigname); - WRITE_NODE_FIELD(relation); - WRITE_NODE_FIELD(funcname); - WRITE_NODE_FIELD(args); - WRITE_BOOL_FIELD(before); - WRITE_BOOL_FIELD(row); - WRITE_STRING_FIELD(actions); - WRITE_BOOL_FIELD(isconstraint); - WRITE_BOOL_FIELD(deferrable); - WRITE_BOOL_FIELD(initdeferred); - WRITE_NODE_FIELD(constrrel); - WRITE_OID_FIELD(trigOid); - -} - -static void -_outCreateFileSpaceStmt(StringInfo str, CreateFileSpaceStmt *node) -{ - WRITE_NODE_TYPE("CREATEFILESPACESTMT"); - - WRITE_STRING_FIELD(filespacename); - WRITE_STRING_FIELD(owner); - WRITE_NODE_FIELD(locations); - WRITE_OID_FIELD(fsoid); -} - -static void -_outFileSpaceEntry(StringInfo str, FileSpaceEntry *node) -{ - WRITE_NODE_TYPE("FILESPACEENTRY"); - - WRITE_INT_FIELD(dbid); - WRITE_INT_FIELD(contentid); - WRITE_STRING_FIELD(location); - WRITE_STRING_FIELD(hostname); -} - -static void -_outCreateTableSpaceStmt(StringInfo str, CreateTableSpaceStmt *node) -{ - WRITE_NODE_TYPE("CREATETABLESPACESTMT"); - - WRITE_STRING_FIELD(tablespacename); - WRITE_STRING_FIELD(owner); - WRITE_STRING_FIELD(filespacename); - WRITE_OID_FIELD(tsoid); -} - static void _outCreateQueueStmt(StringInfo str, CreateQueueStmt *node) { @@ -3669,7 +1100,7 @@ _outCreateQueueStmt(StringInfo str, CreateQueueStmt *node) WRITE_STRING_FIELD(queue); WRITE_NODE_FIELD(options); /* List of DefElem nodes */ - WRITE_OID_FIELD(queueOid); + WRITE_OID_FIELD(queueOid); WRITE_NODE_FIELD(optids); /* List of oids for nodes */ } @@ -3683,54 +1114,18 @@ _outAlterQueueStmt(StringInfo str, AlterQueueStmt *node) WRITE_NODE_FIELD(optids); /* List of oids for nodes */ } -static void -_outDropQueueStmt(StringInfo str, DropQueueStmt *node) -{ - WRITE_NODE_TYPE("DROPQUEUESTMT"); - - WRITE_STRING_FIELD(queue); -} - -static void -_outCommentStmt(StringInfo str, CommentStmt *node) -{ - WRITE_NODE_TYPE("COMMENTSTMT"); - - WRITE_ENUM_FIELD(objtype, ObjectType); - WRITE_NODE_FIELD(objname); - WRITE_NODE_FIELD(objargs); - WRITE_STRING_FIELD(comment); -} - - -static void -_outTableValueExpr(StringInfo str, TableValueExpr *node) -{ - WRITE_NODE_TYPE("TABLEVALUEEXPR"); - - WRITE_NODE_FIELD(subquery); -} - -static void -_outAlterTypeStmt(StringInfo str, AlterTypeStmt *node) -{ - WRITE_NODE_TYPE("ALTERTYPESTMT"); - - WRITE_NODE_FIELD(typname); - WRITE_NODE_FIELD(encoding); -} - static void _outTupleDescNode(StringInfo str, TupleDescNode *node) { + int i; + Assert(node->tuple->tdtypeid == RECORDOID); WRITE_NODE_TYPE("TUPLEDESCNODE"); WRITE_INT_FIELD(natts); WRITE_INT_FIELD(tuple->natts); - int i = 0; - for (; i < node->tuple->natts; i++) + for (i = 0; i < node->tuple->natts; i++) appendBinaryStringInfo(str, node->tuple->attrs[i], ATTRIBUTE_FIXED_PART_SIZE); Assert(node->tuple->constr == NULL); @@ -4346,7 +1741,7 @@ _outNode(StringInfo str, void *obj) case T_DropUserMappingStmt: _outDropUserMappingStmt(str, obj); break; - + case T_TransactionStmt: _outTransactionStmt(str, obj); break; diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index 15bb22b074..a1dc065eb2 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -38,6 +38,15 @@ #include "utils/workfile_mgr.h" #include "parser/parsetree.h" + +/* + * outfuncs.c is compiled normally into outfuncs.o, but it's also + * #included from outfast.c. When #included, outfast.c defines + * COMPILING_BINARY_FUNCS, and provides replacements WRITE_* macros. See + * comments at top of readfast.c. + */ +#ifndef COMPILING_BINARY_FUNCS + /* * Macros to simplify output of different kinds of fields. Use these * wherever possible to reduce the chance for silly typos. Note that these @@ -130,6 +139,7 @@ static void _outNode(StringInfo str, void *obj); + /* When serializing a plan for workfile caching, we want to leave out * all variable fields by setting this to false */ static bool print_variable_fields = true; @@ -270,11 +280,16 @@ _outDatum(StringInfo str, Datum value, int typlen, bool typbyval) } } +#endif /* COMPILING_BINARY_FUNCS */ + +static void _outPlanInfo(StringInfo str, Plan *node); +static void outLogicalIndexInfo(StringInfo str, LogicalIndexInfo *node); /* * Stuff from plannodes.h */ +#ifndef COMPILING_BINARY_FUNCS static void _outPlannedStmt(StringInfo str, PlannedStmt *node) { @@ -311,14 +326,15 @@ _outPlannedStmt(StringInfo str, PlannedStmt *node) WRITE_UINT64_FIELD(query_mem); WRITE_NODE_FIELD(transientTypeRecords); } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS /* * print the basic stuff of all nodes that inherit from Plan */ static void _outPlanInfo(StringInfo str, Plan *node) { - if (print_variable_fields) { WRITE_INT_FIELD(plan_node_id); @@ -350,12 +366,13 @@ _outPlanInfo(StringInfo str, Plan *node) WRITE_NODE_FIELD(lefttree); WRITE_NODE_FIELD(righttree); WRITE_NODE_FIELD(initPlan); - + if (print_variable_fields) { WRITE_UINT64_FIELD(operatorMemKB); } } +#endif /* COMPILING_BINARY_FUNCS */ /* * print the basic stuff of all nodes that inherit from Scan @@ -547,6 +564,7 @@ _outExternalScan(StringInfo str, ExternalScan *node) WRITE_INT_FIELD(scancounter); } +#ifndef COMPILING_BINARY_FUNCS static void outLogicalIndexInfo(StringInfo str, LogicalIndexInfo *node) { @@ -564,6 +582,7 @@ outLogicalIndexInfo(StringInfo str, LogicalIndexInfo *node) WRITE_NODE_FIELD(partCons); WRITE_NODE_FIELD(defaultLevels); } +#endif /* COMPILING_BINARY_FUNCS */ static void outIndexScanFields(StringInfo str, IndexScan *node) @@ -653,6 +672,7 @@ _outTidScan(StringInfo str, TidScan *node) WRITE_NODE_FIELD(tidquals); } +#ifndef COMPILING_BINARY_FUNCS static void _outSubqueryScan(StringInfo str, SubqueryScan *node) { @@ -663,6 +683,7 @@ _outSubqueryScan(StringInfo str, SubqueryScan *node) WRITE_NODE_FIELD(subplan); WRITE_NODE_FIELD(subrtable); /* debugging convenience */ } +#endif /* COMPILING_BINARY_FUNCS */ static void _outFunctionScan(StringInfo str, FunctionScan *node) @@ -722,6 +743,7 @@ _outHashJoin(StringInfo str, HashJoin *node) WRITE_NODE_FIELD(hashqualclauses); } +#ifndef COMPILING_BINARY_FUNCS static void _outAgg(StringInfo str, Agg *node) { @@ -751,7 +773,9 @@ _outAgg(StringInfo str, Agg *node) WRITE_BOOL_FIELD(lastAgg); WRITE_BOOL_FIELD(streaming); } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS static void _outWindowKey(StringInfo str, WindowKey *node) { @@ -770,8 +794,9 @@ _outWindowKey(StringInfo str, WindowKey *node) WRITE_NODE_FIELD(frame); } +#endif /* COMPILING_BINARY_FUNCS */ - +#ifndef COMPILING_BINARY_FUNCS static void _outWindow(StringInfo str, Window *node) { @@ -789,6 +814,7 @@ _outWindow(StringInfo str, Window *node) WRITE_NODE_FIELD(windowKeys); } +#endif /* COMPILING_BINARY_FUNCS */ static void _outTableFunctionScan(StringInfo str, TableFunctionScan *node) @@ -826,6 +852,7 @@ _outShareInputScan(StringInfo str, ShareInputScan *node) _outPlanInfo(str, (Plan *) node); } +#ifndef COMPILING_BINARY_FUNCS static void _outSort(StringInfo str, Sort *node) { @@ -856,7 +883,9 @@ _outSort(StringInfo str, Sort *node) WRITE_INT_FIELD(nsharer); WRITE_INT_FIELD(nsharer_xslice); } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS static void _outUnique(StringInfo str, Unique *node) { @@ -872,7 +901,9 @@ _outUnique(StringInfo str, Unique *node) for (i = 0; i < node->numCols; i++) appendStringInfo(str, " %d", node->uniqColIdx[i]); } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS static void _outSetOp(StringInfo str, SetOp *node) { @@ -891,6 +922,7 @@ _outSetOp(StringInfo str, SetOp *node) WRITE_INT_FIELD(flagColIdx); } +#endif /* COMPILING_BINARY_FUNCS */ static void _outLimit(StringInfo str, Limit *node) @@ -912,6 +944,7 @@ _outHash(StringInfo str, Hash *node) WRITE_BOOL_FIELD(rescannable); /*CDB*/ } +#ifndef COMPILING_BINARY_FUNCS static void _outMotion(StringInfo str, Motion *node) { @@ -945,6 +978,7 @@ _outMotion(StringInfo str, Motion *node) _outPlanInfo(str, (Plan *) node); } +#endif /* COMPILING_BINARY_FUNCS */ /* * _outDML @@ -1112,6 +1146,7 @@ _outVar(StringInfo str, Var *node) WRITE_INT_FIELD(varoattno); } +#ifndef COMPILING_BINARY_FUNCS static void _outConst(StringInfo str, Const *node) { @@ -1128,6 +1163,7 @@ _outConst(StringInfo str, Const *node) else _outDatum(str, node->constvalue, node->constlen, node->constbyval); } +#endif /* COMPILING_BINARY_FUNCS */ static void _outParam(StringInfo str, Param *node) @@ -1139,6 +1175,7 @@ _outParam(StringInfo str, Param *node) WRITE_OID_FIELD(paramtype); } +#ifndef COMPILING_BINARY_FUNCS static void _outAggref(StringInfo str, Aggref *node) { @@ -1167,6 +1204,7 @@ _outAggref(StringInfo str, Aggref *node) if (node->aggorder != NULL) WRITE_NODE_FIELD(aggorder); } +#endif /* COMPILING_BINARY_FUNCS */ static void _outAggOrder(StringInfo str, AggOrder *node) @@ -1208,6 +1246,7 @@ _outArrayRef(StringInfo str, ArrayRef *node) WRITE_NODE_FIELD(refassgnexpr); } +#ifndef COMPILING_BINARY_FUNCS static void _outFuncExpr(StringInfo str, FuncExpr *node) { @@ -1224,6 +1263,7 @@ _outFuncExpr(StringInfo str, FuncExpr *node) WRITE_BOOL_FIELD(is_tablefunc); /* GPDB */ } } +#endif /* COMPILING_BINARY_FUNCS */ static void _outOpExpr(StringInfo str, OpExpr *node) @@ -1260,6 +1300,7 @@ _outScalarArrayOpExpr(StringInfo str, ScalarArrayOpExpr *node) WRITE_NODE_FIELD(args); } +#ifndef COMPILING_BINARY_FUNCS static void _outBoolExpr(StringInfo str, BoolExpr *node) { @@ -1285,7 +1326,9 @@ _outBoolExpr(StringInfo str, BoolExpr *node) WRITE_NODE_FIELD(args); } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS static void _outSubLink(StringInfo str, SubLink *node) { @@ -1302,6 +1345,7 @@ _outSubLink(StringInfo str, SubLink *node) */ WRITE_NODE_FIELD(subselect); } +#endif /* COMPILING_BINARY_FUNCS */ static void _outSubPlan(StringInfo str, SubPlan *node) @@ -1508,6 +1552,7 @@ _outSetToDefault(StringInfo str, SetToDefault *node) WRITE_INT_FIELD(typeMod); } +#ifndef COMPILING_BINARY_FUNCS static void _outCurrentOfExpr(StringInfo str, CurrentOfExpr *node) { @@ -1519,6 +1564,7 @@ _outCurrentOfExpr(StringInfo str, CurrentOfExpr *node) /* some attributes omitted as they're bound only just before executor dispatch */ } +#endif /* COMPILING_BINARY_FUNCS */ static void _outTargetEntry(StringInfo str, TargetEntry *node) @@ -1542,6 +1588,7 @@ _outRangeTblRef(StringInfo str, RangeTblRef *node) WRITE_INT_FIELD(rtindex); } +#ifndef COMPILING_BINARY_FUNCS static void _outJoinExpr(StringInfo str, JoinExpr *node) { @@ -1558,6 +1605,7 @@ _outJoinExpr(StringInfo str, JoinExpr *node) WRITE_NODE_FIELD(alias); WRITE_INT_FIELD(rtindex); } +#endif /* COMPILING_BINARY_FUNCS */ static void _outFromExpr(StringInfo str, FromExpr *node) @@ -1568,6 +1616,7 @@ _outFromExpr(StringInfo str, FromExpr *node) WRITE_NODE_FIELD(quals); } +#ifndef COMPILING_BINARY_FUNCS static void _outFlow(StringInfo str, Flow *node) { @@ -1605,6 +1654,7 @@ _outFlow(StringInfo str, Flow *node) WRITE_NODE_FIELD(flow_before_req_move); } +#endif /* COMPILING_BINARY_FUNCS */ /***************************************************************************** * @@ -1768,7 +1818,6 @@ _outAOCSPath(StringInfo str, AOCSPath *node) _outPathInfo(str, (Path *) node); } - static void _outResultPath(StringInfo str, ResultPath *node) { @@ -1845,6 +1894,7 @@ _outCdbMotionPath(StringInfo str, CdbMotionPath *node) WRITE_NODE_FIELD(subpath); } +#ifndef COMPILING_BINARY_FUNCS static void _outPlannerGlobal(StringInfo str, PlannerGlobal *node) { @@ -1867,6 +1917,7 @@ _outPlannerGlobal(StringInfo str, PlannerGlobal *node) WRITE_NODE_FIELD(share.planNodes); WRITE_INT_FIELD(share.nextPlanId); } +#endif /* COMPILING_BINARY_FUNCS */ static void _outPlannerInfo(StringInfo str, PlannerInfo *node) @@ -1935,6 +1986,7 @@ _outRelOptInfo(StringInfo str, RelOptInfo *node) /* WRITE_NODE_FIELD(index_inner_paths); */ } +#ifndef COMPILING_BINARY_FUNCS static void _outIndexOptInfo(StringInfo str, IndexOptInfo *node) { @@ -1970,7 +2022,9 @@ _outIndexOptInfo(StringInfo str, IndexOptInfo *node) WRITE_BOOL_FIELD(amoptionalkey); WRITE_BOOL_FIELD(cdb_default_stats_used); } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS static void _outCdbRelColumnInfo(StringInfo str, CdbRelColumnInfo *node) { @@ -1983,6 +2037,7 @@ _outCdbRelColumnInfo(StringInfo str, CdbRelColumnInfo *node) WRITE_STRING_FIELD(colname); WRITE_NODE_FIELD(defexpr); } +#endif /* COMPILING_BINARY_FUNCS */ static void _outCdbRelDedupInfo(StringInfo str, CdbRelDedupInfo *node) @@ -2043,6 +2098,7 @@ _outInnerIndexscanInfo(StringInfo str, InnerIndexscanInfo *node) WRITE_NODE_FIELD(cheapest_total_innerpath); } +#ifndef COMPILING_BINARY_FUNCS static void _outOuterJoinInfo(StringInfo str, OuterJoinInfo *node) { @@ -2058,6 +2114,7 @@ _outOuterJoinInfo(StringInfo str, OuterJoinInfo *node) WRITE_NODE_FIELD(left_equi_key_list); WRITE_NODE_FIELD(right_equi_key_list); } +#endif /* COMPILING_BINARY_FUNCS */ static void _outInClauseInfo(StringInfo str, InClauseInfo *node) @@ -2089,6 +2146,7 @@ _outAppendRelInfo(StringInfo str, AppendRelInfo *node) * *****************************************************************************/ +#ifndef COMPILING_BINARY_FUNCS static void _outCreateStmt(StringInfo str, CreateStmt *node) { @@ -2131,6 +2189,7 @@ _outCreateStmt(StringInfo str, CreateStmt *node) WRITE_BOOL_FIELD(buildAoBlkdir); WRITE_NODE_FIELD(attr_encodings); } +#endif /* COMPILING_BINARY_FUNCS */ static void _outColumnReferenceStorageDirective(StringInfo str, ColumnReferenceStorageDirective *node) @@ -2259,8 +2318,6 @@ _outDropStmt(StringInfo str, DropStmt *node) WRITE_ENUM_FIELD(behavior, DropBehavior); WRITE_BOOL_FIELD(missing_ok); WRITE_BOOL_FIELD(bAllowPartn); - - } static void @@ -2273,7 +2330,6 @@ _outDropPropertyStmt(StringInfo str, DropPropertyStmt *node) WRITE_ENUM_FIELD(removeType, ObjectType); WRITE_ENUM_FIELD(behavior, DropBehavior); WRITE_BOOL_FIELD(missing_ok); - } static void @@ -2362,6 +2418,7 @@ _outInheritPartitionCmd(StringInfo str, InheritPartitionCmd *node) WRITE_NODE_FIELD(parent); } +#ifndef COMPILING_BINARY_FUNCS static void _outAlterPartitionCmd(StringInfo str, AlterPartitionCmd *node) { @@ -2371,6 +2428,7 @@ _outAlterPartitionCmd(StringInfo str, AlterPartitionCmd *node) WRITE_NODE_FIELD(arg1); WRITE_NODE_FIELD(arg2); } +#endif /* COMPILING_BINARY_FUNCS */ static void _outAlterPartitionId(StringInfo str, AlterPartitionId *node) @@ -2390,7 +2448,6 @@ _outCreateRoleStmt(StringInfo str, CreateRoleStmt *node) WRITE_STRING_FIELD(role); WRITE_NODE_FIELD(options); WRITE_OID_FIELD(roleOid); - } static void @@ -2452,7 +2509,6 @@ _outAlterOwnerStmt(StringInfo str, AlterOwnerStmt *node) WRITE_NODE_FIELD(objarg); WRITE_STRING_FIELD(addname); WRITE_STRING_FIELD(newowner); - } @@ -2469,7 +2525,6 @@ _outRenameStmt(StringInfo str, RenameStmt *node) WRITE_STRING_FIELD(newname); WRITE_ENUM_FIELD(renameType,ObjectType); WRITE_BOOL_FIELD(bAllowPartn); - } static void @@ -2544,6 +2599,7 @@ _outDropdbStmt(StringInfo str, DropdbStmt *node) WRITE_BOOL_FIELD(missing_ok); } +#ifndef COMPILING_BINARY_FUNCS static void _outCreateDomainStmt(StringInfo str, CreateDomainStmt *node) { @@ -2553,7 +2609,9 @@ _outCreateDomainStmt(StringInfo str, CreateDomainStmt *node) WRITE_NODE_FIELD(constraints); WRITE_OID_FIELD(domainOid); } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS static void _outAlterDomainStmt(StringInfo str, AlterDomainStmt *node) { @@ -2564,6 +2622,7 @@ _outAlterDomainStmt(StringInfo str, AlterDomainStmt *node) WRITE_NODE_FIELD(def); WRITE_ENUM_FIELD(behavior, DropBehavior); } +#endif /* COMPILING_BINARY_FUNCS */ static void _outCreateFdwStmt(StringInfo str, CreateFdwStmt *node) @@ -2671,7 +2730,6 @@ _outFunctionParameter(StringInfo str, FunctionParameter *node) WRITE_STRING_FIELD(name); WRITE_NODE_FIELD(argType); WRITE_ENUM_FIELD(mode, FunctionParameterMode); - } static void @@ -2708,6 +2766,7 @@ _outPartitionBy(StringInfo str, PartitionBy *node) WRITE_INT_FIELD(location); } +#ifndef COMPILING_BINARY_FUNCS static void _outPartitionSpec(StringInfo str, PartitionSpec *node) { @@ -2717,6 +2776,7 @@ _outPartitionSpec(StringInfo str, PartitionSpec *node) WRITE_BOOL_FIELD(istemplate); WRITE_INT_FIELD(location); } +#endif /* COMPILING_BINARY_FUNCS */ static void _outPartitionElem(StringInfo str, PartitionElem *node) @@ -2742,6 +2802,7 @@ _outPartitionRangeItem(StringInfo str, PartitionRangeItem *node) WRITE_INT_FIELD(location); } +#ifndef COMPILING_BINARY_FUNCS static void _outPartitionBoundSpec(StringInfo str, PartitionBoundSpec *node) { @@ -2753,6 +2814,7 @@ _outPartitionBoundSpec(StringInfo str, PartitionBoundSpec *node) WRITE_STRING_FIELD(pWithTnameStr); WRITE_INT_FIELD(location); } +#endif /* COMPILING_BINARY_FUNCS */ static void _outPartitionValuesSpec(StringInfo str, PartitionValuesSpec *node) @@ -2762,6 +2824,7 @@ _outPartitionValuesSpec(StringInfo str, PartitionValuesSpec *node) WRITE_INT_FIELD(location); } +#ifndef COMPILING_BINARY_FUNCS static void _outInhRelation(StringInfo str, InhRelation *node) { @@ -2769,7 +2832,9 @@ _outInhRelation(StringInfo str, InhRelation *node) WRITE_NODE_FIELD(relation); WRITE_NODE_FIELD(options); } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS static void _outPartition(StringInfo str, Partition *node) { @@ -2791,7 +2856,9 @@ _outPartition(StringInfo str, Partition *node) for (i = 0; i < node->parnatts; i++) appendStringInfo(str, " %d", node->parclass[i]); } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS static void _outPartitionRule(StringInfo str, PartitionRule *node) { @@ -2813,6 +2880,7 @@ _outPartitionRule(StringInfo str, PartitionRule *node) WRITE_OID_FIELD(partemplatespaceId); WRITE_NODE_FIELD(children); } +#endif /* COMPILING_BINARY_FUNCS */ static void _outPartitionNode(StringInfo str, PartitionNode *node) @@ -2860,7 +2928,6 @@ _outDefineStmt(StringInfo str, DefineStmt *node) WRITE_OID_FIELD(shadowOid); WRITE_BOOL_FIELD(ordered); /* CDB */ WRITE_BOOL_FIELD(trusted); /* CDB */ - } static void @@ -2872,7 +2939,6 @@ _outCompositeTypeStmt(StringInfo str, CompositeTypeStmt *node) WRITE_NODE_FIELD(coldeflist); WRITE_OID_FIELD(relOid); WRITE_OID_FIELD(comptypeOid); - } static void @@ -2949,7 +3015,6 @@ _outTransactionStmt(StringInfo str, TransactionStmt *node) WRITE_ENUM_FIELD(kind, TransactionStmtKind); WRITE_NODE_FIELD(options); - } static void @@ -3057,6 +3122,7 @@ _outConstraintsSetStmt(StringInfo str, ConstraintsSetStmt *node) WRITE_BOOL_FIELD(deferred); } +#ifndef COMPILING_BINARY_FUNCS static void _outInsertStmt(StringInfo str, InsertStmt *node) { @@ -3067,8 +3133,9 @@ _outInsertStmt(StringInfo str, InsertStmt *node) WRITE_NODE_FIELD(selectStmt); WRITE_NODE_FIELD(returningList); } +#endif /* COMPILING_BINARY_FUNCS */ - +#ifndef COMPILING_BINARY_FUNCS /* * SelectStmt's are never written to the catalog, they only exist * between parse and parseTransform. The only use of this function @@ -3103,6 +3170,7 @@ _outSelectStmt(StringInfo str, SelectStmt *node) WRITE_NODE_FIELD(rarg); WRITE_NODE_FIELD(distributedBy); } +#endif /* COMPILING_BINARY_FUNCS */ static void _outFuncCall(StringInfo str, FuncCall *node) @@ -3189,6 +3257,7 @@ _outPartBoundOpenExpr(StringInfo str, PartBoundOpenExpr *node) WRITE_BOOL_FIELD(isLowerBound); } +#ifndef COMPILING_BINARY_FUNCS static void _outColumnDef(StringInfo str, ColumnDef *node) { @@ -3207,7 +3276,9 @@ _outColumnDef(StringInfo str, ColumnDef *node) WRITE_NODE_FIELD(constraints); WRITE_NODE_FIELD(encoding); } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS static void _outTypeName(StringInfo str, TypeName *node) { @@ -3222,7 +3293,9 @@ _outTypeName(StringInfo str, TypeName *node) WRITE_NODE_FIELD(arrayBounds); WRITE_INT_FIELD(location); } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS static void _outTypeCast(StringInfo str, TypeCast *node) { @@ -3231,6 +3304,7 @@ _outTypeCast(StringInfo str, TypeCast *node) WRITE_NODE_FIELD(arg); WRITE_NODE_FIELD_AS(typname, typename); } +#endif /* COMPILING_BINARY_FUNCS */ static void _outIndexElem(StringInfo str, IndexElem *node) @@ -3246,9 +3320,11 @@ static void _outVariableResetStmt(StringInfo str, VariableResetStmt *node) { WRITE_NODE_TYPE("VARIABLERESETSTMT"); + WRITE_STRING_FIELD(name); } +#ifndef COMPILING_BINARY_FUNCS static void _outQuery(StringInfo str, Query *node) { @@ -3379,6 +3455,7 @@ _outQuery(StringInfo str, Query *node) WRITE_NODE_FIELD(returningLists); /* TODO Merge issue */ /* Don't serialize policy */ } +#endif /* COMPILING_BINARY_FUNCS */ static void _outSortClause(StringInfo str, SortClause *node) @@ -3535,6 +3612,7 @@ _outSetOperationStmt(StringInfo str, SetOperationStmt *node) WRITE_NODE_FIELD(colTypmods); } +#ifndef COMPILING_BINARY_FUNCS static void _outRangeTblEntry(StringInfo str, RangeTblEntry *node) { @@ -3599,7 +3677,9 @@ _outRangeTblEntry(StringInfo str, RangeTblEntry *node) WRITE_BOOL_FIELD(forceDistRandom); WRITE_NODE_FIELD(pseudocols); /*CDB*/ } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS static void _outAExpr(StringInfo str, A_Expr *node) { @@ -3655,7 +3735,9 @@ _outAExpr(StringInfo str, A_Expr *node) WRITE_NODE_FIELD(rexpr); WRITE_INT_FIELD(location); } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS static void _outValue(StringInfo str, Value *value) { @@ -3690,12 +3772,15 @@ _outValue(StringInfo str, Value *value) break; } } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS static void _outNull(StringInfo str, Node *n __attribute__((unused))) { WRITE_NODE_TYPE("NULL"); } +#endif /* COMPILING_BINARY_FUNCS */ static void _outColumnRef(StringInfo str, ColumnRef *node) @@ -3715,6 +3800,7 @@ _outParamRef(StringInfo str, ParamRef *node) WRITE_INT_FIELD(location); /*CDB*/ } +#ifndef COMPILING_BINARY_FUNCS static void _outAConst(StringInfo str, A_Const *node) { @@ -3731,6 +3817,7 @@ _outAConst(StringInfo str, A_Const *node) * view or rule definition is stored in the catalog. */ } +#endif /* COMPILING_BINARY_FUNCS */ static void _outA_Indices(StringInfo str, A_Indices *node) @@ -3761,6 +3848,7 @@ _outResTarget(StringInfo str, ResTarget *node) WRITE_INT_FIELD(location); } +#ifndef COMPILING_BINARY_FUNCS static void _outConstraint(StringInfo str, Constraint *node) { @@ -3807,6 +3895,7 @@ _outConstraint(StringInfo str, Constraint *node) break; } } +#endif /* COMPILING_BINARY_FUNCS */ static void _outFkConstraint(StringInfo str, FkConstraint *node) @@ -3839,7 +3928,6 @@ _outCreateSchemaStmt(StringInfo str, CreateSchemaStmt *node) WRITE_STRING_FIELD(authid); WRITE_BOOL_FIELD(istemp); WRITE_OID_FIELD(schemaOid); - } static void @@ -3854,7 +3942,6 @@ _outCreatePLangStmt(StringInfo str, CreatePLangStmt *node) WRITE_OID_FIELD(plangOid); WRITE_OID_FIELD(plhandlerOid); WRITE_OID_FIELD(plvalidatorOid); - } static void @@ -3890,7 +3977,6 @@ _outVacuumStmt(StringInfo str, VacuumStmt *node) WRITE_BOOL_FIELD(heap_truncate); } - static void _outCdbProcess(StringInfo str, CdbProcess *node) { @@ -3931,8 +4017,6 @@ _outSliceTable(StringInfo str, SliceTable *node) WRITE_INT_FIELD(ic_instance_id); } - - static void _outCreateTrigStmt(StringInfo str, CreateTrigStmt *node) { @@ -3950,7 +4034,6 @@ _outCreateTrigStmt(StringInfo str, CreateTrigStmt *node) WRITE_BOOL_FIELD(initdeferred); WRITE_NODE_FIELD(constrrel); WRITE_OID_FIELD(trigOid); - } static void @@ -3986,7 +4069,7 @@ _outCreateTableSpaceStmt(StringInfo str, CreateTableSpaceStmt *node) WRITE_OID_FIELD(tsoid); } - +#ifndef COMPILING_BINARY_FUNCS static void _outCreateQueueStmt(StringInfo str, CreateQueueStmt *node) { @@ -3996,7 +4079,9 @@ _outCreateQueueStmt(StringInfo str, CreateQueueStmt *node) WRITE_NODE_FIELD(options); /* List of DefElem nodes */ WRITE_OID_FIELD(queueOid); } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS static void _outAlterQueueStmt(StringInfo str, AlterQueueStmt *node) { @@ -4005,6 +4090,7 @@ _outAlterQueueStmt(StringInfo str, AlterQueueStmt *node) WRITE_STRING_FIELD(queue); WRITE_NODE_FIELD(options); /* List of DefElem nodes */ } +#endif /* COMPILING_BINARY_FUNCS */ static void _outDropQueueStmt(StringInfo str, DropQueueStmt *node) @@ -4043,6 +4129,7 @@ _outAlterTypeStmt(StringInfo str, AlterTypeStmt *node) WRITE_NODE_FIELD(encoding); } +#ifndef COMPILING_BINARY_FUNCS static void _outTupleDescNode(StringInfo str, TupleDescNode *node) { @@ -4065,7 +4152,9 @@ _outTupleDescNode(StringInfo str, TupleDescNode *node) WRITE_BOOL_FIELD(tuple->tdhasoid); WRITE_INT_FIELD(tuple->tdrefcount); } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS /* * _outNode - * converts a Node into ascii string and append it to 'str' @@ -4952,3 +5041,5 @@ nodeToString(void *obj) _outNode(&str, obj); return str.data; } + +#endif /* COMPILING_BINARY_FUNCS */ diff --git a/src/backend/nodes/readfast.c b/src/backend/nodes/readfast.c index 490837a92d..c62009f200 100644 --- a/src/backend/nodes/readfast.c +++ b/src/backend/nodes/readfast.c @@ -10,6 +10,19 @@ * These routines must be exactly the inverse of the routines in * outfast.c. * + * For most node types, these routines are identical to the text reader + * functions, in readfuncs.c. To avoid code duplication and merge hazards + * (readfast.c is a Greenplum addon), most read routines borrow the source + * definition from readfuncs.c, we just compile it with different READ_* + * macros. + * + * The way that works is that readfast.c defines all the necessary macros, + * as well as COMPILING_BINARY_FUNCS, and then #includes readfuncs.c. For + * those node types where the binary and text functions are different, + * the function in readfuncs.c is put in a #ifndef COMPILING_BINARY_FUNCS + * block, and readfast.c provides the binary version of the function. + * outfast.c and outfuncs.c have a similar relationship. + * *------------------------------------------------------------------------- */ #include "postgres.h" @@ -173,6 +186,18 @@ static Datum readDatum(bool typbyval); */ static const char *read_str_ptr; +/* + * For most structs, we reuse the definitions from readfuncs.c. See comment + * in reafuncs.c. + */ +#define COMPILING_BINARY_FUNCS +#include "readfuncs.c" + +/* + * For some structs, we have to provide a read functions because it differs + * from the text version (or the text version doesn't exist at all). + */ + /* * _readQuery */ @@ -216,35 +241,6 @@ _readQuery(void) READ_DONE(); } -/* - * _readNotifyStmt - */ -static NotifyStmt * -_readNotifyStmt(void) -{ - READ_LOCALS(NotifyStmt); - - READ_NODE_FIELD(relation); - - READ_DONE(); -} - -/* - * _readDeclareCursorStmt - */ -static DeclareCursorStmt * -_readDeclareCursorStmt(void) -{ - READ_LOCALS(DeclareCursorStmt); - - READ_STRING_FIELD(portalname); - READ_INT_FIELD(options); - READ_NODE_FIELD(query); - READ_BOOL_FIELD(is_simply_updatable); - - READ_DONE(); -} - /* * _readCurrentOfExpr */ @@ -263,104 +259,6 @@ _readCurrentOfExpr(void) READ_DONE(); } -/* - * _readSingleRowErrorDesc - */ -static SingleRowErrorDesc * -_readSingleRowErrorDesc(void) -{ - READ_LOCALS(SingleRowErrorDesc); - - READ_NODE_FIELD(errtable); - READ_INT_FIELD(rejectlimit); - READ_BOOL_FIELD(is_keep); - READ_BOOL_FIELD(is_limit_in_rows); - READ_BOOL_FIELD(reusing_existing_errtable); - READ_BOOL_FIELD(into_file); - - READ_DONE(); -} - -/* - * _readSortClause - */ -static SortClause * -_readSortClause(void) -{ - READ_LOCALS(SortClause); - - READ_UINT_FIELD(tleSortGroupRef); - READ_OID_FIELD(sortop); - - READ_DONE(); -} - -/* - * _readGroupClause - */ -static GroupClause * -_readGroupClause(void) -{ - READ_LOCALS(GroupClause); - - READ_UINT_FIELD(tleSortGroupRef); - READ_OID_FIELD(sortop); - - READ_DONE(); -} - -/* - * _readGroupingClause - */ -static GroupingClause * -_readGroupingClause(void) -{ - READ_LOCALS(GroupingClause); - - READ_ENUM_FIELD(groupType, GroupingType); - READ_NODE_FIELD(groupsets); - - READ_DONE(); -} - -static GroupingFunc * -_readGroupingFunc(void) -{ - READ_LOCALS(GroupingFunc); - - READ_NODE_FIELD(args); - READ_INT_FIELD(ngrpcols); - - READ_DONE(); -} - -static Grouping * -_readGrouping(void) -{ - READ_LOCALS_NO_FIELDS(Grouping); - - READ_DONE(); -} - -static GroupId * -_readGroupId(void) -{ - READ_LOCALS_NO_FIELDS(GroupId); - - READ_DONE(); -} - -static WindowSpecParse * -_readWindowSpecParse(void) -{ - READ_LOCALS(WindowSpecParse); - - READ_STRING_FIELD(name); - READ_NODE_FIELD(elems); - - READ_DONE(); -} - static WindowSpec * _readWindowSpec(void) { @@ -375,48 +273,6 @@ _readWindowSpec(void) READ_DONE(); } -static WindowFrame * -_readWindowFrame(void) -{ - READ_LOCALS(WindowFrame); - - READ_BOOL_FIELD(is_rows); - READ_BOOL_FIELD(is_between); - READ_NODE_FIELD(trail); - READ_NODE_FIELD(lead); - READ_ENUM_FIELD(exclude, WindowExclusion); - - READ_DONE(); -} - -static WindowFrameEdge * -_readWindowFrameEdge(void) -{ - READ_LOCALS(WindowFrameEdge); - - READ_ENUM_FIELD(kind, WindowBoundingKind); - READ_NODE_FIELD(val); - - READ_DONE(); -} - -static PercentileExpr * -_readPercentileExpr(void) -{ - READ_LOCALS(PercentileExpr); - - READ_OID_FIELD(perctype); - READ_NODE_FIELD(args); - READ_ENUM_FIELD(perckind, PercKind); - READ_NODE_FIELD(sortClause); - READ_NODE_FIELD(sortTargets); - READ_NODE_FIELD(pcExpr); - READ_NODE_FIELD(tcExpr); - READ_INT_FIELD(location); - - READ_DONE(); -} - static DMLActionExpr * _readDMLActionExpr(void) { @@ -479,85 +335,10 @@ _readPartBoundOpenExpr(void) READ_DONE(); } -/* - * _readRowMarkClause - */ -static RowMarkClause * -_readRowMarkClause(void) -{ - READ_LOCALS(RowMarkClause); - - READ_UINT_FIELD(rti); - READ_BOOL_FIELD(forUpdate); - READ_BOOL_FIELD(noWait); - - READ_DONE(); -} - -static WithClause * -_readWithClause(void) -{ - READ_LOCALS(WithClause); - - READ_NODE_FIELD(ctes); - READ_BOOL_FIELD(recursive); - READ_INT_FIELD(location); - - READ_DONE(); -} - -static CommonTableExpr * -_readCommonTableExpr(void) -{ - READ_LOCALS(CommonTableExpr); - - READ_STRING_FIELD(ctename); - READ_NODE_FIELD(aliascolnames); - READ_NODE_FIELD(ctequery); - READ_INT_FIELD(location); - READ_BOOL_FIELD(cterecursive); - READ_INT_FIELD(cterefcount); - READ_NODE_FIELD(ctecolnames); - READ_NODE_FIELD(ctecoltypes); - READ_NODE_FIELD(ctecoltypmods); - - READ_DONE(); -} - -/* - * _readSetOperationStmt - */ -static SetOperationStmt * -_readSetOperationStmt(void) -{ - READ_LOCALS(SetOperationStmt); - - READ_ENUM_FIELD(op, SetOperation); - READ_BOOL_FIELD(all); - READ_NODE_FIELD(larg); - READ_NODE_FIELD(rarg); - READ_NODE_FIELD(colTypes); - READ_NODE_FIELD(colTypmods); - - READ_DONE(); -} - - /* * Stuff from primnodes.h. */ -static Alias * -_readAlias(void) -{ - READ_LOCALS(Alias); - - READ_STRING_FIELD(aliasname); - READ_NODE_FIELD(colnames); - - READ_DONE(); -} - static RangeVar * _readRangeVar(void) { @@ -603,25 +384,6 @@ _readIntoClause(void) READ_DONE(); } -/* - * _readVar - */ -static Var * -_readVar(void) -{ - READ_LOCALS(Var); - - READ_UINT_FIELD(varno); - READ_INT_FIELD(varattno); - READ_OID_FIELD(vartype); - READ_INT_FIELD(vartypmod); - READ_UINT_FIELD(varlevelsup); - READ_UINT_FIELD(varnoold); - READ_INT_FIELD(varoattno); - - READ_DONE(); -} - /* * _readConst */ @@ -689,43 +451,6 @@ _readConstraint(void) READ_DONE(); } -static IndexStmt * -_readIndexStmt(void) -{ - READ_LOCALS(IndexStmt); - - READ_STRING_FIELD(idxname); - READ_NODE_FIELD(relation); - READ_STRING_FIELD(accessMethod); - READ_STRING_FIELD(tableSpace); - READ_NODE_FIELD(indexParams); - READ_NODE_FIELD(options); - READ_NODE_FIELD(whereClause); - READ_NODE_FIELD(rangetable); - READ_BOOL_FIELD(is_part_child); - READ_BOOL_FIELD(unique); - READ_BOOL_FIELD(primary); - READ_BOOL_FIELD(isconstraint); - READ_STRING_FIELD(altconname); - READ_OID_FIELD(constrOid); - READ_BOOL_FIELD(concurrent); - READ_NODE_FIELD(idxOids); - - READ_DONE(); -} - -static IndexElem * -_readIndexElem(void) -{ - READ_LOCALS(IndexElem); - - READ_STRING_FIELD(name); - READ_NODE_FIELD(expr); - READ_NODE_FIELD(opclass); - - READ_DONE(); -} - static ReindexStmt * _readReindexStmt(void) { @@ -739,40 +464,6 @@ _readReindexStmt(void) READ_NODE_FIELD(new_ind_oids); READ_OID_FIELD(relid); - READ_DONE(); - -} - -static ViewStmt * -_readViewStmt(void) -{ - READ_LOCALS(ViewStmt); - - READ_NODE_FIELD(view); - READ_NODE_FIELD(aliases); - READ_NODE_FIELD(query); - READ_BOOL_FIELD(replace); - READ_OID_FIELD(relOid); - READ_OID_FIELD(comptypeOid); - READ_OID_FIELD(rewriteOid); - - READ_DONE(); -} - -static RuleStmt * -_readRuleStmt(void) -{ - READ_LOCALS(RuleStmt); - - READ_NODE_FIELD(relation); - READ_STRING_FIELD(rulename); - READ_NODE_FIELD(whereClause); - READ_ENUM_FIELD(event,CmdType); - READ_BOOL_FIELD(instead); - READ_NODE_FIELD(actions); - READ_BOOL_FIELD(replace); - READ_OID_FIELD(ruleOid); - READ_DONE(); } @@ -899,16 +590,6 @@ _readAlterTableCmd(void) READ_DONE(); } -static InheritPartitionCmd * -_readInheritPartitionCmd(void) -{ - READ_LOCALS(InheritPartitionCmd); - - READ_NODE_FIELD(parent); - - READ_DONE(); -} - static AlterPartitionCmd * _readAlterPartitionCmd(void) { @@ -922,87 +603,6 @@ _readAlterPartitionCmd(void) READ_DONE(); } -static AlterPartitionId * -_readAlterPartitionId(void) -{ - READ_LOCALS(AlterPartitionId); - - READ_ENUM_FIELD(idtype, AlterPartitionIdType); - READ_NODE_FIELD(partiddef); - - READ_DONE(); -} - -static CreateRoleStmt * -_readCreateRoleStmt(void) -{ - READ_LOCALS(CreateRoleStmt); - - READ_ENUM_FIELD(stmt_type, RoleStmtType); - READ_STRING_FIELD(role); - READ_NODE_FIELD(options); - READ_OID_FIELD(roleOid); - - READ_DONE(); -} - -static DenyLoginInterval * -_readDenyLoginInterval(void) -{ - READ_LOCALS(DenyLoginInterval); - - READ_NODE_FIELD(start); - READ_NODE_FIELD(end); - - READ_DONE(); -} - -static DenyLoginPoint * -_readDenyLoginPoint(void) -{ - READ_LOCALS(DenyLoginPoint); - - READ_NODE_FIELD(day); - READ_NODE_FIELD(time); - - READ_DONE(); -} - -static DropRoleStmt * -_readDropRoleStmt(void) -{ - READ_LOCALS(DropRoleStmt); - - READ_NODE_FIELD(roles); - READ_BOOL_FIELD(missing_ok); - - READ_DONE(); -} - -static AlterRoleStmt * -_readAlterRoleStmt(void) -{ - READ_LOCALS(AlterRoleStmt); - - READ_STRING_FIELD(role); - READ_NODE_FIELD(options); - READ_INT_FIELD(action); - - READ_DONE(); -} - -static AlterRoleSetStmt * -_readAlterRoleSetStmt(void) -{ - READ_LOCALS(AlterRoleSetStmt); - - READ_STRING_FIELD(role); - READ_STRING_FIELD(variable); - READ_NODE_FIELD(value); - - READ_DONE(); -} - static AlterObjectSchemaStmt * _readAlterObjectSchemaStmt(void) { @@ -1018,8 +618,6 @@ _readAlterObjectSchemaStmt(void) READ_DONE(); } - - static AlterOwnerStmt * _readAlterOwnerStmt(void) { @@ -1036,24 +634,6 @@ _readAlterOwnerStmt(void) } -static RenameStmt * -_readRenameStmt(void) -{ - READ_LOCALS(RenameStmt); - - READ_NODE_FIELD(relation); - READ_OID_FIELD(objid); - READ_NODE_FIELD(object); - READ_NODE_FIELD(objarg); - READ_STRING_FIELD(subname); - READ_STRING_FIELD(newname); - READ_ENUM_FIELD(renameType,ObjectType); - READ_BOOL_FIELD(bAllowPartn); - - READ_DONE(); -} - - /* * _readFuncCall * @@ -1076,17 +656,6 @@ _readFuncCall(void) READ_DONE(); } -static DefElem * -_readDefElem(void) -{ - READ_LOCALS(DefElem); - - READ_STRING_FIELD(defname); - READ_NODE_FIELD(arg); - READ_ENUM_FIELD(defaction, DefElemAction); - READ_DONE(); -} - static A_Const * _readAConst(void) { @@ -1094,8 +663,6 @@ _readAConst(void) READ_ENUM_FIELD(val.type, NodeTag); - - switch (local_node->val.type) { case T_Integer: @@ -1119,7 +686,6 @@ _readAConst(void) break; } - local_node->typname = NULL; READ_NODE_FIELD(typname); READ_INT_FIELD(location); /*CDB*/ @@ -1209,22 +775,7 @@ _readAExpr(void) } /* - * _readParam - */ -static Param * -_readParam(void) -{ - READ_LOCALS(Param); - - READ_ENUM_FIELD(paramkind, ParamKind); - READ_INT_FIELD(paramid); - READ_OID_FIELD(paramtype); - - READ_DONE(); -} - -/* - * _readAggref + * _readAggref */ static Aggref * _readAggref(void) @@ -1243,61 +794,6 @@ _readAggref(void) READ_DONE(); } -/* - * _outAggOrder - */ -static AggOrder * -_readAggOrder(void) -{ - READ_LOCALS(AggOrder); - - READ_BOOL_FIELD(sortImplicit); - READ_NODE_FIELD(sortTargets); - READ_NODE_FIELD(sortClause); - - READ_DONE(); -} - -/* - * _readWindowRef - */ -static WindowRef * -_readWindowRef(void) -{ - READ_LOCALS(WindowRef); - - READ_OID_FIELD(winfnoid); - READ_OID_FIELD(restype); - READ_NODE_FIELD(args); - READ_UINT_FIELD(winlevelsup); - READ_BOOL_FIELD(windistinct); - READ_UINT_FIELD(winspec); - READ_UINT_FIELD(winindex); - READ_ENUM_FIELD(winstage, WinStage); - READ_UINT_FIELD(winlevel); - - READ_DONE(); -} - -/* - * _readArrayRef - */ -static ArrayRef * -_readArrayRef(void) -{ - READ_LOCALS(ArrayRef); - - READ_OID_FIELD(refrestype); - READ_OID_FIELD(refarraytype); - READ_OID_FIELD(refelemtype); - READ_NODE_FIELD(refupperindexpr); - READ_NODE_FIELD(reflowerindexpr); - READ_NODE_FIELD(refexpr); - READ_NODE_FIELD(refassgnexpr); - - READ_DONE(); -} - /* * _readFuncExpr */ @@ -1438,190 +934,6 @@ _readSubPlan(void) READ_DONE(); } -/* - * _readFieldSelect - */ -static FieldSelect * -_readFieldSelect(void) -{ - READ_LOCALS(FieldSelect); - - READ_NODE_FIELD(arg); - READ_INT_FIELD(fieldnum); - READ_OID_FIELD(resulttype); - READ_INT_FIELD(resulttypmod); - - READ_DONE(); -} - -/* - * _readFieldStore - */ -static FieldStore * -_readFieldStore(void) -{ - READ_LOCALS(FieldStore); - - READ_NODE_FIELD(arg); - READ_NODE_FIELD(newvals); - READ_NODE_FIELD(fieldnums); - READ_OID_FIELD(resulttype); - - READ_DONE(); -} - -/* - * _readRelabelType - */ -static RelabelType * -_readRelabelType(void) -{ - READ_LOCALS(RelabelType); - - READ_NODE_FIELD(arg); - READ_OID_FIELD(resulttype); - READ_INT_FIELD(resulttypmod); - READ_ENUM_FIELD(relabelformat, CoercionForm); - - READ_DONE(); -} - -/* - * _readConvertRowtypeExpr - */ -static ConvertRowtypeExpr * -_readConvertRowtypeExpr(void) -{ - READ_LOCALS(ConvertRowtypeExpr); - - READ_NODE_FIELD(arg); - READ_OID_FIELD(resulttype); - READ_ENUM_FIELD(convertformat, CoercionForm); - - READ_DONE(); -} - -/* - * _readCaseExpr - */ -static CaseExpr * -_readCaseExpr(void) -{ - READ_LOCALS(CaseExpr); - - READ_OID_FIELD(casetype); - READ_NODE_FIELD(arg); - READ_NODE_FIELD(args); - READ_NODE_FIELD(defresult); - - READ_DONE(); -} - -/* - * _readCaseWhen - */ -static CaseWhen * -_readCaseWhen(void) -{ - READ_LOCALS(CaseWhen); - - READ_NODE_FIELD(expr); - READ_NODE_FIELD(result); - - READ_DONE(); -} - -/* - * _readCaseTestExpr - */ -static CaseTestExpr * -_readCaseTestExpr(void) -{ - READ_LOCALS(CaseTestExpr); - - READ_OID_FIELD(typeId); - READ_INT_FIELD(typeMod); - - READ_DONE(); -} - -/* - * _readArrayExpr - */ -static ArrayExpr * -_readArrayExpr(void) -{ - READ_LOCALS(ArrayExpr); - - READ_OID_FIELD(array_typeid); - READ_OID_FIELD(element_typeid); - READ_NODE_FIELD(elements); - READ_BOOL_FIELD(multidims); - - READ_DONE(); -} - -/* - * _readRowExpr - */ -static RowExpr * -_readRowExpr(void) -{ - READ_LOCALS(RowExpr); - - READ_NODE_FIELD(args); - READ_OID_FIELD(row_typeid); - READ_ENUM_FIELD(row_format, CoercionForm); - - READ_DONE(); -} - -/* - * _readRowCompareExpr - */ -static RowCompareExpr * -_readRowCompareExpr(void) -{ - READ_LOCALS(RowCompareExpr); - - READ_ENUM_FIELD(rctype, RowCompareType); - READ_NODE_FIELD(opnos); - READ_NODE_FIELD(opclasses); - READ_NODE_FIELD(largs); - READ_NODE_FIELD(rargs); - - READ_DONE(); -} - -/* - * _readCoalesceExpr - */ -static CoalesceExpr * -_readCoalesceExpr(void) -{ - READ_LOCALS(CoalesceExpr); - - READ_OID_FIELD(coalescetype); - READ_NODE_FIELD(args); - - READ_DONE(); -} - -/* - * _readMinMaxExpr - */ -static MinMaxExpr * -_readMinMaxExpr(void) -{ - READ_LOCALS(MinMaxExpr); - - READ_OID_FIELD(minmaxtype); - READ_ENUM_FIELD(op, MinMaxOp); - READ_NODE_FIELD(args); - - READ_DONE(); -} - /* * _readNullIfExpr */ @@ -1640,110 +952,6 @@ _readNullIfExpr(void) READ_DONE(); } -/* - * _readNullTest - */ -static NullTest * -_readNullTest(void) -{ - READ_LOCALS(NullTest); - - READ_NODE_FIELD(arg); - READ_ENUM_FIELD(nulltesttype, NullTestType); - - READ_DONE(); -} - -/* - * _readBooleanTest - */ -static BooleanTest * -_readBooleanTest(void) -{ - READ_LOCALS(BooleanTest); - - READ_NODE_FIELD(arg); - READ_ENUM_FIELD(booltesttype, BoolTestType); - - READ_DONE(); -} - -/* - * _readCoerceToDomain - */ -static CoerceToDomain * -_readCoerceToDomain(void) -{ - READ_LOCALS(CoerceToDomain); - - READ_NODE_FIELD(arg); - READ_OID_FIELD(resulttype); - READ_INT_FIELD(resulttypmod); - READ_ENUM_FIELD(coercionformat, CoercionForm); - - READ_DONE(); -} - -/* - * _readCoerceToDomainValue - */ -static CoerceToDomainValue * -_readCoerceToDomainValue(void) -{ - READ_LOCALS(CoerceToDomainValue); - - READ_OID_FIELD(typeId); - READ_INT_FIELD(typeMod); - - READ_DONE(); -} - -/* - * _readSetToDefault - */ -static SetToDefault * -_readSetToDefault(void) -{ - READ_LOCALS(SetToDefault); - - READ_OID_FIELD(typeId); - READ_INT_FIELD(typeMod); - - READ_DONE(); -} - -/* - * _readTargetEntry - */ -static TargetEntry * -_readTargetEntry(void) -{ - READ_LOCALS(TargetEntry); - - READ_NODE_FIELD(expr); - READ_INT_FIELD(resno); - READ_STRING_FIELD(resname); - READ_UINT_FIELD(ressortgroupref); - READ_OID_FIELD(resorigtbl); - READ_INT_FIELD(resorigcol); - READ_BOOL_FIELD(resjunk); - - READ_DONE(); -} - -/* - * _readRangeTblRef - */ -static RangeTblRef * -_readRangeTblRef(void) -{ - READ_LOCALS(RangeTblRef); - - READ_INT_FIELD(rtindex); - - READ_DONE(); -} - /* * _readJoinExpr */ @@ -1764,86 +972,10 @@ _readJoinExpr(void) READ_DONE(); } -/* - * _readFromExpr - */ -static FromExpr * -_readFromExpr(void) -{ - READ_LOCALS(FromExpr); - - READ_NODE_FIELD(fromlist); - READ_NODE_FIELD(quals); - - READ_DONE(); -} - - /* * Stuff from parsenodes.h. */ -static ColumnDef * -_readColumnDef(void) -{ - READ_LOCALS(ColumnDef); - - READ_STRING_FIELD(colname); - READ_NODE_FIELD(typname); - READ_INT_FIELD(inhcount); - READ_BOOL_FIELD(is_local); - READ_BOOL_FIELD(is_not_null); - READ_INT_FIELD(attnum); - READ_OID_FIELD(default_oid); - READ_NODE_FIELD(raw_default); - READ_BOOL_FIELD(default_is_null); - READ_STRING_FIELD(cooked_default); - READ_NODE_FIELD(constraints); - READ_NODE_FIELD(encoding); - - READ_DONE(); -} - -static ColumnRef * -_readColumnRef(void) -{ - READ_LOCALS(ColumnRef); - - READ_NODE_FIELD(fields); - READ_INT_FIELD(location); - - READ_DONE(); -} - -static TypeName * -_readTypeName(void) -{ - READ_LOCALS(TypeName); - - READ_NODE_FIELD(names); - READ_OID_FIELD(typid); - READ_BOOL_FIELD(timezone); - READ_BOOL_FIELD(setof); - READ_BOOL_FIELD(pct_type); - READ_INT_FIELD(typmod); - READ_NODE_FIELD(arrayBounds); - READ_INT_FIELD(location); - - READ_DONE(); -} - -static TypeCast * -_readTypeCast(void) -{ - READ_LOCALS(TypeCast); - - READ_NODE_FIELD(arg); - READ_NODE_FIELD(typname); - - READ_DONE(); -} - - /* * _readRangeTblEntry */ @@ -1985,533 +1117,201 @@ _readCreateStmt(void) READ_DONE(); } -static ColumnReferenceStorageDirective * -_readColumnReferenceStorageDirective(void) -{ - READ_LOCALS(ColumnReferenceStorageDirective); - - READ_NODE_FIELD(column); - READ_BOOL_FIELD(deflt); - READ_NODE_FIELD(encoding); - - READ_DONE(); -} - - -static PartitionBy * -_readPartitionBy(void) -{ - READ_LOCALS(PartitionBy); - - READ_ENUM_FIELD(partType, PartitionByType); - READ_NODE_FIELD(keys); - READ_NODE_FIELD(keyopclass); - READ_NODE_FIELD(partNum); - READ_NODE_FIELD(subPart); - READ_NODE_FIELD(partSpec); - READ_INT_FIELD(partDepth); - READ_INT_FIELD(partQuiet); - READ_INT_FIELD(location); - - READ_DONE(); -} - -static PartitionSpec * -_readPartitionSpec(void) -{ - READ_LOCALS(PartitionSpec); - - READ_NODE_FIELD(partElem); - READ_NODE_FIELD(subSpec); - READ_BOOL_FIELD(istemplate); - READ_INT_FIELD(location); - READ_NODE_FIELD(enc_clauses); - - READ_DONE(); -} - -static PartitionElem * -_readPartitionElem(void) -{ - READ_LOCALS(PartitionElem); - - READ_NODE_FIELD(partName); - READ_NODE_FIELD(boundSpec); - READ_NODE_FIELD(subSpec); - READ_BOOL_FIELD(isDefault); - READ_NODE_FIELD(storeAttr); - READ_INT_FIELD(partno); - READ_LONG_FIELD(rrand); - READ_NODE_FIELD(colencs); - READ_INT_FIELD(location); - - READ_DONE(); -} - -static PartitionRangeItem * -_readPartitionRangeItem(void) -{ - READ_LOCALS(PartitionRangeItem); - - READ_NODE_FIELD(partRangeVal); - READ_ENUM_FIELD(partedge, PartitionEdgeBounding); - READ_INT_FIELD(location); - - READ_DONE(); -} - -static PartitionBoundSpec * -_readPartitionBoundSpec(void) -{ - READ_LOCALS(PartitionBoundSpec); - - READ_NODE_FIELD(partStart); - READ_NODE_FIELD(partEnd); - READ_NODE_FIELD(partEvery); - READ_INT_FIELD(location); - - READ_DONE(); -} - -static PartitionValuesSpec * -_readPartitionValuesSpec(void) -{ - READ_LOCALS(PartitionValuesSpec); - - READ_NODE_FIELD(partValues); - READ_INT_FIELD(location); - - READ_DONE(); -} - -static Partition * -_readPartition(void) -{ - READ_LOCALS(Partition); - - READ_OID_FIELD(partid); - READ_OID_FIELD(parrelid); - READ_CHAR_FIELD(parkind); - READ_INT_FIELD(parlevel); - READ_BOOL_FIELD(paristemplate); - READ_BINARY_FIELD(parnatts, sizeof(int2)); - READ_INT_ARRAY(paratts, parnatts, int2); - READ_OID_ARRAY(parclass, parnatts); - - READ_DONE(); -} - -static PartitionRule * -_readPartitionRule(void) -{ - READ_LOCALS(PartitionRule); - - READ_OID_FIELD(parruleid); - READ_OID_FIELD(paroid); - READ_OID_FIELD(parchildrelid); - READ_OID_FIELD(parparentoid); - READ_BOOL_FIELD(parisdefault); - READ_STRING_FIELD(parname); - READ_NODE_FIELD(parrangestart); - READ_BOOL_FIELD(parrangestartincl); - READ_NODE_FIELD(parrangeend); - READ_BOOL_FIELD(parrangeendincl); - READ_NODE_FIELD(parrangeevery); - READ_NODE_FIELD(parlistvalues); - READ_BINARY_FIELD(parruleord, sizeof(int2)); - READ_NODE_FIELD(parreloptions); - READ_OID_FIELD(partemplatespaceId); - READ_NODE_FIELD(children); - - READ_DONE(); -} - -static PartitionNode * -_readPartitionNode(void) -{ - READ_LOCALS(PartitionNode); - - READ_NODE_FIELD(part); - READ_NODE_FIELD(default_part); - READ_NODE_FIELD(rules); - - READ_DONE(); -} - -static PgPartRule * -_readPgPartRule(void) -{ - READ_LOCALS(PgPartRule); - - READ_NODE_FIELD(pNode); - READ_NODE_FIELD(topRule); - READ_STRING_FIELD(partIdStr); - READ_BOOL_FIELD(isName); - READ_INT_FIELD(topRuleRank); - READ_STRING_FIELD(relname); - - READ_DONE(); -} - -static SegfileMapNode * -_readSegfileMapNode(void) -{ - READ_LOCALS(SegfileMapNode); - - READ_OID_FIELD(relid); - READ_INT_FIELD(segno); - - READ_DONE(); -} - -static ExtTableTypeDesc * -_readExtTableTypeDesc(void) -{ - READ_LOCALS(ExtTableTypeDesc); - - READ_ENUM_FIELD(exttabletype, ExtTableType); - READ_NODE_FIELD(location_list); - READ_NODE_FIELD(on_clause); - READ_STRING_FIELD(command_string); - - READ_DONE(); -} - -static CreateExternalStmt * -_readCreateExternalStmt(void) -{ - READ_LOCALS(CreateExternalStmt); - - READ_NODE_FIELD(relation); - READ_NODE_FIELD(tableElts); - READ_NODE_FIELD(exttypedesc); - READ_STRING_FIELD(format); - READ_NODE_FIELD(formatOpts); - READ_BOOL_FIELD(isweb); - READ_BOOL_FIELD(iswritable); - READ_NODE_FIELD(sreh); - READ_NODE_FIELD(encoding); - READ_NODE_FIELD(distributedBy); - - READ_DONE(); -} - -static CreateForeignStmt * -_readCreateForeignStmt(void) -{ - READ_LOCALS(CreateForeignStmt); - - READ_NODE_FIELD(relation); - READ_NODE_FIELD(tableElts); - READ_STRING_FIELD(srvname); - READ_NODE_FIELD(options); - - READ_DONE(); -} - -static FkConstraint * -_readFkConstraint(void) -{ - READ_LOCALS(FkConstraint); - - READ_STRING_FIELD(constr_name); - READ_OID_FIELD(constrOid); - READ_NODE_FIELD(pktable); - READ_NODE_FIELD(fk_attrs); - READ_NODE_FIELD(pk_attrs); - READ_CHAR_FIELD(fk_matchtype); - READ_CHAR_FIELD(fk_upd_action); - READ_CHAR_FIELD(fk_del_action); - READ_BOOL_FIELD(deferrable); - READ_BOOL_FIELD(initdeferred); - READ_BOOL_FIELD(skip_validation); - READ_OID_FIELD(trig1Oid); - READ_OID_FIELD(trig2Oid); - READ_OID_FIELD(trig3Oid); - READ_OID_FIELD(trig4Oid); - - READ_DONE(); -} - -static CreateSchemaStmt * -_readCreateSchemaStmt(void) -{ - READ_LOCALS(CreateSchemaStmt); - - READ_STRING_FIELD(schemaname); - READ_STRING_FIELD(authid); - local_node->schemaElts = 0; - READ_BOOL_FIELD(istemp); - READ_OID_FIELD(schemaOid); - - READ_DONE(); -} - - -static CreatePLangStmt * -_readCreatePLangStmt(void) -{ - READ_LOCALS(CreatePLangStmt); - - READ_STRING_FIELD(plname); - READ_NODE_FIELD(plhandler); - READ_NODE_FIELD(plvalidator); - READ_BOOL_FIELD(pltrusted); - READ_OID_FIELD(plangOid); - READ_OID_FIELD(plhandlerOid); - READ_OID_FIELD(plvalidatorOid); - - READ_DONE(); - -} - -static DropPLangStmt * -_readDropPLangStmt(void) -{ - READ_LOCALS(DropPLangStmt); - - READ_STRING_FIELD(plname); - READ_ENUM_FIELD(behavior, DropBehavior); Assert(local_node->behavior <= DROP_CASCADE); - READ_BOOL_FIELD(missing_ok); - - READ_DONE(); - -} - -static CreateSeqStmt * -_readCreateSeqStmt(void) -{ - READ_LOCALS(CreateSeqStmt); - READ_NODE_FIELD(sequence); - READ_NODE_FIELD(options); - - READ_OID_FIELD(relOid); - READ_OID_FIELD(comptypeOid); - - READ_DONE(); -} - -static AlterSeqStmt * -_readAlterSeqStmt(void) -{ - READ_LOCALS(AlterSeqStmt); - READ_NODE_FIELD(sequence); - READ_NODE_FIELD(options); - - READ_DONE(); -} - -static ClusterStmt * -_readClusterStmt(void) -{ - READ_LOCALS(ClusterStmt); - - READ_NODE_FIELD(relation); - READ_STRING_FIELD(indexname); - READ_OID_FIELD(oidInfo.relOid); - READ_OID_FIELD(oidInfo.comptypeOid); - READ_OID_FIELD(oidInfo.toastOid); - READ_OID_FIELD(oidInfo.toastIndexOid); - READ_OID_FIELD(oidInfo.toastComptypeOid); - READ_OID_FIELD(oidInfo.aosegOid); - READ_OID_FIELD(oidInfo.aosegIndexOid); - READ_OID_FIELD(oidInfo.aosegComptypeOid); - READ_OID_FIELD(oidInfo.aovisimapOid); - READ_OID_FIELD(oidInfo.aovisimapIndexOid); - READ_OID_FIELD(oidInfo.aovisimapComptypeOid); - READ_OID_FIELD(oidInfo.aoblkdirOid); - READ_OID_FIELD(oidInfo.aoblkdirIndexOid); - READ_OID_FIELD(oidInfo.aoblkdirComptypeOid); - READ_NODE_FIELD(new_ind_oids); - - READ_DONE(); -} - -static CreatedbStmt * -_readCreatedbStmt(void) -{ - READ_LOCALS(CreatedbStmt); - READ_STRING_FIELD(dbname); - READ_NODE_FIELD(options); - - READ_OID_FIELD(dbOid); - - READ_DONE(); -} - -static DropdbStmt * -_readDropdbStmt(void) -{ - READ_LOCALS(DropdbStmt); - - READ_STRING_FIELD(dbname); - READ_BOOL_FIELD(missing_ok); - - READ_DONE(); -} - -static CreateDomainStmt * -_readCreateDomainStmt(void) +static ColumnReferenceStorageDirective * +_readColumnReferenceStorageDirective(void) { - READ_LOCALS(CreateDomainStmt); + READ_LOCALS(ColumnReferenceStorageDirective); - READ_NODE_FIELD(domainname); - READ_NODE_FIELD(typname); - READ_NODE_FIELD(constraints); - READ_OID_FIELD(domainOid); + READ_NODE_FIELD(column); + READ_BOOL_FIELD(deflt); + READ_NODE_FIELD(encoding); READ_DONE(); } -static AlterDomainStmt * -_readAlterDomainStmt(void) + +static PartitionBy * +_readPartitionBy(void) { - READ_LOCALS(AlterDomainStmt); + READ_LOCALS(PartitionBy); - READ_CHAR_FIELD(subtype); - READ_NODE_FIELD(typname); - READ_STRING_FIELD(name); - READ_NODE_FIELD(def); - READ_ENUM_FIELD(behavior, DropBehavior); Assert(local_node->behavior <= DROP_CASCADE); + READ_ENUM_FIELD(partType, PartitionByType); + READ_NODE_FIELD(keys); + READ_NODE_FIELD(keyopclass); + READ_NODE_FIELD(partNum); + READ_NODE_FIELD(subPart); + READ_NODE_FIELD(partSpec); + READ_INT_FIELD(partDepth); + READ_INT_FIELD(partQuiet); + READ_INT_FIELD(location); READ_DONE(); } -static CreateFdwStmt * -_readCreateFdwStmt(void) +static PartitionSpec * +_readPartitionSpec(void) { - READ_LOCALS(CreateFdwStmt); + READ_LOCALS(PartitionSpec); - READ_STRING_FIELD(fdwname); - READ_NODE_FIELD(validator); - READ_NODE_FIELD(options); + READ_NODE_FIELD(partElem); + READ_NODE_FIELD(subSpec); + READ_BOOL_FIELD(istemplate); + READ_INT_FIELD(location); + READ_NODE_FIELD(enc_clauses); READ_DONE(); } -static AlterFdwStmt * -_readAlterFdwStmt(void) +static PartitionElem * +_readPartitionElem(void) { - READ_LOCALS(AlterFdwStmt); + READ_LOCALS(PartitionElem); - READ_STRING_FIELD(fdwname); - READ_NODE_FIELD(validator); - READ_BOOL_FIELD(change_validator); - READ_NODE_FIELD(options); + READ_NODE_FIELD(partName); + READ_NODE_FIELD(boundSpec); + READ_NODE_FIELD(subSpec); + READ_BOOL_FIELD(isDefault); + READ_NODE_FIELD(storeAttr); + READ_INT_FIELD(partno); + READ_LONG_FIELD(rrand); + READ_NODE_FIELD(colencs); + READ_INT_FIELD(location); READ_DONE(); } -static DropFdwStmt * -_readDropFdwStmt(void) +static PartitionRangeItem * +_readPartitionRangeItem(void) { - READ_LOCALS(DropFdwStmt); + READ_LOCALS(PartitionRangeItem); - READ_STRING_FIELD(fdwname); - READ_BOOL_FIELD(missing_ok); - READ_ENUM_FIELD(behavior, DropBehavior); + READ_NODE_FIELD(partRangeVal); + READ_ENUM_FIELD(partedge, PartitionEdgeBounding); + READ_INT_FIELD(location); READ_DONE(); } -static CreateForeignServerStmt * -_readCreateForeignServerStmt(void) +static PartitionBoundSpec * +_readPartitionBoundSpec(void) { - READ_LOCALS(CreateForeignServerStmt); + READ_LOCALS(PartitionBoundSpec); - READ_STRING_FIELD(servername); - READ_STRING_FIELD(servertype); - READ_STRING_FIELD(version); - READ_STRING_FIELD(fdwname); - READ_NODE_FIELD(options); + READ_NODE_FIELD(partStart); + READ_NODE_FIELD(partEnd); + READ_NODE_FIELD(partEvery); + READ_INT_FIELD(location); READ_DONE(); } -static AlterForeignServerStmt * -_readAlterForeignServerStmt(void) +static PartitionValuesSpec * +_readPartitionValuesSpec(void) { - READ_LOCALS(AlterForeignServerStmt); + READ_LOCALS(PartitionValuesSpec); - READ_STRING_FIELD(servername); - READ_STRING_FIELD(version); - READ_NODE_FIELD(options); - READ_BOOL_FIELD(has_version); + READ_NODE_FIELD(partValues); + READ_INT_FIELD(location); READ_DONE(); } -static DropForeignServerStmt * -_readDropForeignServerStmt(void) +static Partition * +_readPartition(void) { - READ_LOCALS(DropForeignServerStmt); + READ_LOCALS(Partition); - READ_STRING_FIELD(servername); - READ_BOOL_FIELD(missing_ok); - READ_ENUM_FIELD(behavior, DropBehavior); + READ_OID_FIELD(partid); + READ_OID_FIELD(parrelid); + READ_CHAR_FIELD(parkind); + READ_INT_FIELD(parlevel); + READ_BOOL_FIELD(paristemplate); + READ_BINARY_FIELD(parnatts, sizeof(int2)); + READ_INT_ARRAY(paratts, parnatts, int2); + READ_OID_ARRAY(parclass, parnatts); READ_DONE(); } -static CreateUserMappingStmt * -_readCreateUserMappingStmt(void) +static PartitionRule * +_readPartitionRule(void) { - READ_LOCALS(CreateUserMappingStmt); + READ_LOCALS(PartitionRule); - READ_STRING_FIELD(username); - READ_STRING_FIELD(servername); - READ_NODE_FIELD(options); + READ_OID_FIELD(parruleid); + READ_OID_FIELD(paroid); + READ_OID_FIELD(parchildrelid); + READ_OID_FIELD(parparentoid); + READ_BOOL_FIELD(parisdefault); + READ_STRING_FIELD(parname); + READ_NODE_FIELD(parrangestart); + READ_BOOL_FIELD(parrangestartincl); + READ_NODE_FIELD(parrangeend); + READ_BOOL_FIELD(parrangeendincl); + READ_NODE_FIELD(parrangeevery); + READ_NODE_FIELD(parlistvalues); + READ_BINARY_FIELD(parruleord, sizeof(int2)); + READ_NODE_FIELD(parreloptions); + READ_OID_FIELD(partemplatespaceId); + READ_NODE_FIELD(children); READ_DONE(); } -static AlterUserMappingStmt * -_readAlterUserMappingStmt(void) +static PartitionNode * +_readPartitionNode(void) { - READ_LOCALS(AlterUserMappingStmt); + READ_LOCALS(PartitionNode); - READ_STRING_FIELD(username); - READ_STRING_FIELD(servername); - READ_NODE_FIELD(options); + READ_NODE_FIELD(part); + READ_NODE_FIELD(default_part); + READ_NODE_FIELD(rules); READ_DONE(); } -static DropUserMappingStmt * -_readDropUserMappingStmt(void) +static CreateExternalStmt * +_readCreateExternalStmt(void) { - READ_LOCALS(DropUserMappingStmt); + READ_LOCALS(CreateExternalStmt); - READ_STRING_FIELD(username); - READ_STRING_FIELD(servername); - READ_BOOL_FIELD(missing_ok); + READ_NODE_FIELD(relation); + READ_NODE_FIELD(tableElts); + READ_NODE_FIELD(exttypedesc); + READ_STRING_FIELD(format); + READ_NODE_FIELD(formatOpts); + READ_BOOL_FIELD(isweb); + READ_BOOL_FIELD(iswritable); + READ_NODE_FIELD(sreh); + READ_NODE_FIELD(encoding); + READ_NODE_FIELD(distributedBy); READ_DONE(); } -static CreateFunctionStmt * -_readCreateFunctionStmt(void) +static DropPLangStmt * +_readDropPLangStmt(void) { - READ_LOCALS(CreateFunctionStmt); - READ_BOOL_FIELD(replace); - READ_NODE_FIELD(funcname); - READ_NODE_FIELD(parameters); - READ_NODE_FIELD(returnType); - READ_NODE_FIELD(options); - READ_NODE_FIELD(withClause); - READ_OID_FIELD(funcOid); - READ_OID_FIELD(shelltypeOid); + READ_LOCALS(DropPLangStmt); + + READ_STRING_FIELD(plname); + READ_ENUM_FIELD(behavior, DropBehavior); Assert(local_node->behavior <= DROP_CASCADE); + READ_BOOL_FIELD(missing_ok); READ_DONE(); + } -static FunctionParameter * -_readFunctionParameter(void) +static AlterDomainStmt * +_readAlterDomainStmt(void) { - READ_LOCALS(FunctionParameter); + READ_LOCALS(AlterDomainStmt); + + READ_CHAR_FIELD(subtype); + READ_NODE_FIELD(typname); READ_STRING_FIELD(name); - READ_NODE_FIELD(argType); - READ_ENUM_FIELD(mode, FunctionParameterMode); + READ_NODE_FIELD(def); + READ_ENUM_FIELD(behavior, DropBehavior); Assert(local_node->behavior <= DROP_CASCADE); READ_DONE(); } @@ -2529,17 +1329,6 @@ _readRemoveFuncStmt(void) READ_DONE(); } -static AlterFunctionStmt * -_readAlterFunctionStmt(void) -{ - READ_LOCALS(AlterFunctionStmt); - READ_NODE_FIELD(func); - READ_NODE_FIELD(actions); - - READ_DONE(); -} - - static DefineStmt * _readDefineStmt(void) { @@ -2558,32 +1347,6 @@ _readDefineStmt(void) } -static CompositeTypeStmt * -_readCompositeTypeStmt(void) -{ - READ_LOCALS(CompositeTypeStmt); - - READ_NODE_FIELD(typevar); - READ_NODE_FIELD(coldeflist); - READ_OID_FIELD(comptypeOid); - - READ_DONE(); - -} - -static CreateCastStmt * -_readCreateCastStmt(void) -{ - READ_LOCALS(CreateCastStmt); - READ_NODE_FIELD(sourcetype); - READ_NODE_FIELD(targettype); - READ_NODE_FIELD(func); - READ_ENUM_FIELD(context, CoercionContext); - READ_OID_FIELD(castOid); - - READ_DONE(); -} - static DropCastStmt * _readDropCastStmt(void) { @@ -2596,34 +1359,6 @@ _readDropCastStmt(void) READ_DONE(); } -static CreateOpClassStmt * -_readCreateOpClassStmt(void) -{ - READ_LOCALS(CreateOpClassStmt); - READ_NODE_FIELD(opclassname); - READ_STRING_FIELD(amname); - READ_NODE_FIELD(datatype); - READ_NODE_FIELD(items); - READ_BOOL_FIELD(isDefault); - READ_OID_FIELD(opclassOid); - - READ_DONE(); -} - -static CreateOpClassItem * -_readCreateOpClassItem(void) -{ - READ_LOCALS(CreateOpClassItem); - READ_INT_FIELD(itemtype); - READ_NODE_FIELD(name); - READ_NODE_FIELD(args); - READ_INT_FIELD(number); - READ_BOOL_FIELD(recheck); - READ_NODE_FIELD(storedtype); - - READ_DONE(); -} - static RemoveOpClassStmt * _readRemoveOpClassStmt(void) { @@ -2636,20 +1371,6 @@ _readRemoveOpClassStmt(void) READ_DONE(); } -static CreateConversionStmt * -_readCreateConversionStmt(void) -{ - READ_LOCALS(CreateConversionStmt); - READ_NODE_FIELD(conversion_name); - READ_STRING_FIELD(for_encoding_name); - READ_STRING_FIELD(to_encoding_name); - READ_NODE_FIELD(func_name); - READ_BOOL_FIELD(def); - READ_OID_FIELD(convOid); - - READ_DONE(); -} - static CopyStmt * _readCopyStmt(void) { @@ -2685,25 +1406,6 @@ _readGrantStmt(void) READ_DONE(); } -static PrivGrantee * -_readPrivGrantee(void) -{ - READ_LOCALS(PrivGrantee); - READ_STRING_FIELD(rolname); - - READ_DONE(); -} - -static FuncWithArgs * -_readFuncWithArgs(void) -{ - READ_LOCALS(FuncWithArgs); - READ_NODE_FIELD(funcname); - READ_NODE_FIELD(funcargs); - - READ_DONE(); -} - static GrantRoleStmt * _readGrantRoleStmt(void) { @@ -2718,27 +1420,6 @@ _readGrantRoleStmt(void) READ_DONE(); } -static LockStmt * -_readLockStmt(void) -{ - READ_LOCALS(LockStmt); - READ_NODE_FIELD(relations); - READ_INT_FIELD(mode); - READ_BOOL_FIELD(nowait); - - READ_DONE(); -} - -static ConstraintsSetStmt * -_readConstraintsSetStmt(void) -{ - READ_LOCALS(ConstraintsSetStmt); - READ_NODE_FIELD(constraints); - READ_BOOL_FIELD(deferred); - - READ_DONE(); -} - /* * _readPlannedStmt */ @@ -3560,48 +2241,6 @@ _readPartitionSelector(void) READ_DONE(); } - -/* - * _readVacuumStmt - */ -static VacuumStmt * -_readVacuumStmt(void) -{ - READ_LOCALS(VacuumStmt); - - READ_BOOL_FIELD(vacuum); - READ_BOOL_FIELD(full); - READ_BOOL_FIELD(analyze); - READ_BOOL_FIELD(verbose); - READ_BOOL_FIELD(rootonly); - READ_INT_FIELD(freeze_min_age); - READ_NODE_FIELD(relation); - READ_NODE_FIELD(va_cols); - READ_NODE_FIELD(expanded_relids); - READ_NODE_FIELD(extra_oids); - - READ_NODE_FIELD(appendonly_compaction_segno); - READ_NODE_FIELD(appendonly_compaction_insert_segno); - READ_BOOL_FIELD(appendonly_compaction_vacuum_cleanup); - READ_BOOL_FIELD(appendonly_compaction_vacuum_prepare); - READ_BOOL_FIELD(heap_truncate); - READ_DONE(); -} - - -static CdbProcess * -_readCdbProcess(void) -{ - READ_LOCALS(CdbProcess); - - READ_STRING_FIELD(listenerAddr); - READ_INT_FIELD(listenerPort); - READ_INT_FIELD(pid); - READ_INT_FIELD(contentid); - - READ_DONE(); -} - static Slice * _readSlice(void) { @@ -3624,34 +2263,6 @@ _readSlice(void) READ_DONE(); } -static SliceTable * -_readSliceTable(void) -{ - READ_LOCALS(SliceTable); - - READ_INT_FIELD(nMotions); - READ_INT_FIELD(nInitPlans); - READ_INT_FIELD(localSlice); - READ_NODE_FIELD(slices); /* List of Slice* */ - READ_BOOL_FIELD(doInstrument); - READ_INT_FIELD(ic_instance_id); - - READ_DONE(); -} - - - -static VariableResetStmt * -_readVariableResetStmt(void) -{ - READ_LOCALS(VariableResetStmt); - - READ_STRING_FIELD(name); - - READ_DONE(); -} - - void readScanInfo(Scan *local_node) { readPlanInfo((Plan *)local_node); @@ -3842,27 +2453,6 @@ _readCommentStmt(void) READ_DONE(); } -static TableValueExpr * -_readTableValueExpr(void) -{ - READ_LOCALS(TableValueExpr); - - READ_NODE_FIELD(subquery); - - READ_DONE(); -} - -static AlterTypeStmt * -_readAlterTypeStmt(void) -{ - READ_LOCALS(AlterTypeStmt); - - READ_NODE_FIELD(typname); - READ_NODE_FIELD(encoding); - - READ_DONE(); -} - static TupleDescNode * _readTupleDescNode(void) { diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c index 5f02c24b13..59e12621d9 100644 --- a/src/backend/nodes/readfuncs.c +++ b/src/backend/nodes/readfuncs.c @@ -34,6 +34,13 @@ #include "utils/lsyscache.h" /* For get_typlenbyval */ #include "cdb/cdbgang.h" +/* + * readfuncs.c is compiled normally into readfuncs.o, but it's also + * #included from readfast.c. When #included, readfuncs.c defines + * COMPILING_BINARY_FUNCS, and provides replacements READ_* macros. See + * comments at top of readfast.c. + */ +#ifndef COMPILING_BINARY_FUNCS /* * Macros to simplify reading of different kinds of fields. Use these @@ -290,10 +297,12 @@ inline static char extended_char(char* token, size_t length) nodeRead(NULL, 0) \ ) +#endif /* COMPILING_BINARY_FUNCS */ static Datum readDatum(bool typbyval); +#ifndef COMPILING_BINARY_FUNCS /* * _readQuery */ @@ -435,6 +444,7 @@ _readQuery(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ /* * _readNotifyStmt @@ -465,6 +475,7 @@ _readDeclareCursorStmt(void) READ_DONE(); } +#ifndef COMPILING_BINARY_FUNCS /* * _readCurrentOfExpr */ @@ -481,6 +492,7 @@ _readCurrentOfExpr(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ /* * _readSingleRowErrorDesc @@ -580,6 +592,7 @@ _readWindowSpecParse(void) READ_DONE(); } +#ifndef COMPILING_BINARY_FUNCS static WindowSpec * _readWindowSpec(void) { @@ -599,6 +612,7 @@ _readWindowSpec(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ static WindowFrame * _readWindowFrame(void) @@ -720,6 +734,7 @@ _readAlias(void) READ_DONE(); } +#ifndef COMPILING_BINARY_FUNCS static RangeVar * _readRangeVar(void) { @@ -742,7 +757,9 @@ _readRangeVar(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS static IntoClause * _readIntoClause(void) { @@ -800,6 +817,7 @@ _readIntoClause(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ /* * _readVar @@ -820,6 +838,7 @@ _readVar(void) READ_DONE(); } +#ifndef COMPILING_BINARY_FUNCS /* * _readConst */ @@ -841,7 +860,9 @@ _readConst(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS /* * _readConstraint */ @@ -893,6 +914,7 @@ _readConstraint(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ static IndexStmt * _readIndexStmt(void) @@ -931,6 +953,7 @@ _readIndexElem(void) READ_DONE(); } +#ifndef COMPILING_BINARY_FUNCS static ReindexStmt * _readReindexStmt(void) { @@ -945,8 +968,8 @@ _readReindexStmt(void) READ_OID_FIELD(relid); READ_DONE(); - } +#endif /* COMPILING_BINARY_FUNCS */ static ViewStmt * _readViewStmt(void) @@ -981,6 +1004,7 @@ _readRuleStmt(void) READ_DONE(); } +#ifndef COMPILING_BINARY_FUNCS static DropStmt * _readDropStmt(void) { @@ -995,7 +1019,9 @@ _readDropStmt(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS static DropPropertyStmt * _readDropPropertyStmt(void) { @@ -1009,7 +1035,9 @@ _readDropPropertyStmt(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS static TruncateStmt * _readTruncateStmt(void) { @@ -1020,7 +1048,9 @@ _readTruncateStmt(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS static AlterTableStmt * _readAlterTableStmt(void) { @@ -1057,7 +1087,9 @@ _readAlterTableStmt(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS static AlterTableCmd * _readAlterTableCmd(void) { @@ -1073,6 +1105,7 @@ _readAlterTableCmd(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ static InheritPartitionCmd * _readInheritPartitionCmd(void) @@ -1084,6 +1117,7 @@ _readInheritPartitionCmd(void) READ_DONE(); } +#ifndef COMPILING_BINARY_FUNCS static AlterPartitionCmd * _readAlterPartitionCmd(void) { @@ -1095,6 +1129,7 @@ _readAlterPartitionCmd(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ static AlterPartitionId * _readAlterPartitionId(void) @@ -1177,6 +1212,7 @@ _readAlterRoleSetStmt(void) READ_DONE(); } +#ifndef COMPILING_BINARY_FUNCS static AlterObjectSchemaStmt * _readAlterObjectSchemaStmt(void) { @@ -1191,9 +1227,9 @@ _readAlterObjectSchemaStmt(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ - - +#ifndef COMPILING_BINARY_FUNCS static AlterOwnerStmt * _readAlterOwnerStmt(void) { @@ -1208,7 +1244,7 @@ _readAlterOwnerStmt(void) READ_DONE(); } - +#endif /* COMPILING_BINARY_FUNCS */ static RenameStmt * _readRenameStmt(void) @@ -1228,6 +1264,7 @@ _readRenameStmt(void) } +#ifndef COMPILING_BINARY_FUNCS /* * _readFuncCall * @@ -1251,6 +1288,7 @@ _readFuncCall(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ static DefElem * _readDefElem(void) @@ -1260,9 +1298,11 @@ _readDefElem(void) READ_STRING_FIELD(defname); READ_NODE_FIELD(arg); READ_ENUM_FIELD(defaction, DefElemAction); + READ_DONE(); } +#ifndef COMPILING_BINARY_FUNCS static A_Const * _readAConst(void) { @@ -1328,8 +1368,9 @@ _readAConst(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ - +#ifndef COMPILING_BINARY_FUNCS static A_Expr * _readAExpr(void) { @@ -1395,6 +1436,7 @@ _readAExpr(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ /* * _readParam @@ -1411,6 +1453,7 @@ _readParam(void) READ_DONE(); } +#ifndef COMPILING_BINARY_FUNCS /* * _readAggref */ @@ -1448,6 +1491,7 @@ _readAggref(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ /* * _outAggOrder @@ -1505,6 +1549,7 @@ _readArrayRef(void) READ_DONE(); } +#ifndef COMPILING_BINARY_FUNCS /* * _readFuncExpr */ @@ -1526,7 +1571,9 @@ _readFuncExpr(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS /* * _readOpExpr */ @@ -1554,7 +1601,9 @@ _readOpExpr(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS /* * _readDistinctExpr */ @@ -1582,7 +1631,9 @@ _readDistinctExpr(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS /* * _readScalarArrayOpExpr */ @@ -1609,7 +1660,9 @@ _readScalarArrayOpExpr(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS /* * _readBoolExpr */ @@ -1634,7 +1687,9 @@ _readBoolExpr(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS /* * _readSubLink */ @@ -1654,6 +1709,7 @@ _readSubLink(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ /* * _readFieldSelect @@ -1839,6 +1895,7 @@ _readMinMaxExpr(void) READ_DONE(); } +#ifndef COMPILING_BINARY_FUNCS /* * _readNullIfExpr */ @@ -1866,6 +1923,7 @@ _readNullIfExpr(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ /* * _readNullTest @@ -1971,6 +2029,7 @@ _readRangeTblRef(void) READ_DONE(); } +#ifndef COMPILING_BINARY_FUNCS /* * _readJoinExpr */ @@ -1991,6 +2050,7 @@ _readJoinExpr(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ /* * _readFromExpr @@ -2072,6 +2132,7 @@ _readTypeCast(void) } +#ifndef COMPILING_BINARY_FUNCS /* * _readRangeTblEntry */ @@ -2140,6 +2201,7 @@ _readRangeTblEntry(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ /* * Greenplum Database additions for serialization support @@ -2147,6 +2209,7 @@ _readRangeTblEntry(void) */ #include "nodes/plannodes.h" +#ifndef COMPILING_BINARY_FUNCS static CreateStmt * _readCreateStmt(void) { @@ -2195,7 +2258,9 @@ _readCreateStmt(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS static Partition * _readPartition(void) { @@ -2212,7 +2277,9 @@ _readPartition(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS static PartitionRule * _readPartitionRule(void) { @@ -2236,7 +2303,9 @@ _readPartitionRule(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ +#ifndef COMPILING_BINARY_FUNCS static PartitionNode * _readPartitionNode(void) { @@ -2247,6 +2316,7 @@ _readPartitionNode(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ static PgPartRule * _readPgPartRule(void) @@ -2287,6 +2357,7 @@ _readExtTableTypeDesc(void) READ_DONE(); } +#ifndef COMPILING_BINARY_FUNCS static CreateExternalStmt * _readCreateExternalStmt(void) { @@ -2306,6 +2377,7 @@ _readCreateExternalStmt(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ static CreateForeignStmt * _readCreateForeignStmt(void) @@ -2373,9 +2445,9 @@ _readCreatePLangStmt(void) READ_OID_FIELD(plvalidatorOid); READ_DONE(); - } +#ifndef COMPILING_BINARY_FUNCS static DropPLangStmt * _readDropPLangStmt(void) { @@ -2386,8 +2458,8 @@ _readDropPLangStmt(void) READ_BOOL_FIELD(missing_ok); READ_DONE(); - } +#endif /* COMPILING_BINARY_FUNCS */ static CreateSeqStmt * _readCreateSeqStmt(void) @@ -2406,6 +2478,7 @@ static AlterSeqStmt * _readAlterSeqStmt(void) { READ_LOCALS(AlterSeqStmt); + READ_NODE_FIELD(sequence); READ_NODE_FIELD(options); @@ -2442,9 +2515,9 @@ static CreatedbStmt * _readCreatedbStmt(void) { READ_LOCALS(CreatedbStmt); + READ_STRING_FIELD(dbname); READ_NODE_FIELD(options); - READ_OID_FIELD(dbOid); READ_DONE(); @@ -2474,6 +2547,7 @@ _readCreateDomainStmt(void) READ_DONE(); } +#ifndef COMPILING_BINARY_FUNCS static AlterDomainStmt * _readAlterDomainStmt(void) { @@ -2487,6 +2561,7 @@ _readAlterDomainStmt(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ static CreateFdwStmt * _readCreateFdwStmt(void) @@ -2604,6 +2679,7 @@ static CreateFunctionStmt * _readCreateFunctionStmt(void) { READ_LOCALS(CreateFunctionStmt); + READ_BOOL_FIELD(replace); READ_NODE_FIELD(funcname); READ_NODE_FIELD(parameters); @@ -2620,6 +2696,7 @@ static FunctionParameter * _readFunctionParameter(void) { READ_LOCALS(FunctionParameter); + READ_STRING_FIELD(name); READ_NODE_FIELD(argType); READ_ENUM_FIELD(mode, FunctionParameterMode); @@ -2627,10 +2704,12 @@ _readFunctionParameter(void) READ_DONE(); } +#ifndef COMPILING_BINARY_FUNCS static RemoveFuncStmt * _readRemoveFuncStmt(void) { READ_LOCALS(RemoveFuncStmt); + READ_ENUM_FIELD(kind,ObjectType); READ_NODE_FIELD(name); READ_NODE_FIELD(args); @@ -2639,6 +2718,7 @@ _readRemoveFuncStmt(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ static AlterFunctionStmt * _readAlterFunctionStmt(void) @@ -2651,6 +2731,7 @@ _readAlterFunctionStmt(void) } +#ifndef COMPILING_BINARY_FUNCS static DefineStmt * _readDefineStmt(void) { @@ -2666,8 +2747,8 @@ _readDefineStmt(void) READ_BOOL_FIELD(trusted); /* CDB */ READ_DONE(); - } +#endif /* COMPILING_BINARY_FUNCS */ static CompositeTypeStmt * _readCompositeTypeStmt(void) @@ -2679,13 +2760,13 @@ _readCompositeTypeStmt(void) READ_OID_FIELD(comptypeOid); READ_DONE(); - } static CreateCastStmt * _readCreateCastStmt(void) { READ_LOCALS(CreateCastStmt); + READ_NODE_FIELD(sourcetype); READ_NODE_FIELD(targettype); READ_NODE_FIELD(func); @@ -2695,10 +2776,12 @@ _readCreateCastStmt(void) READ_DONE(); } +#ifndef COMPILING_BINARY_FUNCS static DropCastStmt * _readDropCastStmt(void) { READ_LOCALS(DropCastStmt); + READ_NODE_FIELD(sourcetype); READ_NODE_FIELD(targettype); READ_ENUM_FIELD(behavior, DropBehavior); @@ -2706,11 +2789,13 @@ _readDropCastStmt(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ static CreateOpClassStmt * _readCreateOpClassStmt(void) { READ_LOCALS(CreateOpClassStmt); + READ_NODE_FIELD(opclassname); READ_STRING_FIELD(amname); READ_NODE_FIELD(datatype); @@ -2735,6 +2820,7 @@ _readCreateOpClassItem(void) READ_DONE(); } +#ifndef COMPILING_BINARY_FUNCS static RemoveOpClassStmt * _readRemoveOpClassStmt(void) { @@ -2746,11 +2832,13 @@ _readRemoveOpClassStmt(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ static CreateConversionStmt * _readCreateConversionStmt(void) { READ_LOCALS(CreateConversionStmt); + READ_NODE_FIELD(conversion_name); READ_STRING_FIELD(for_encoding_name); READ_STRING_FIELD(to_encoding_name); @@ -2761,6 +2849,7 @@ _readCreateConversionStmt(void) READ_DONE(); } +#ifndef COMPILING_BINARY_FUNCS static GrantStmt * _readGrantStmt(void) { @@ -2777,6 +2866,7 @@ _readGrantStmt(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ static PrivGrantee * _readPrivGrantee(void) @@ -2799,6 +2889,7 @@ _readFuncWithArgs(void) READ_DONE(); } +#ifndef COMPILING_BINARY_FUNCS static GrantRoleStmt * _readGrantRoleStmt(void) { @@ -2813,6 +2904,7 @@ _readGrantRoleStmt(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ static LockStmt * _readLockStmt(void) @@ -2837,6 +2929,7 @@ _readConstraintsSetStmt(void) READ_DONE(); } +#ifndef COMPILING_BINARY_FUNCS /* * _readWindowKey */ @@ -2852,6 +2945,7 @@ _readWindowKey(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ /* * _readVacuumStmt @@ -2871,6 +2965,7 @@ _readVacuumStmt(void) READ_NODE_FIELD(va_cols); READ_NODE_FIELD(expanded_relids); READ_NODE_FIELD(extra_oids); + READ_NODE_FIELD(appendonly_compaction_segno); READ_NODE_FIELD(appendonly_compaction_insert_segno); READ_BOOL_FIELD(appendonly_compaction_vacuum_cleanup); @@ -2894,6 +2989,7 @@ _readCdbProcess(void) READ_DONE(); } +#ifndef COMPILING_BINARY_FUNCS static Slice * _readSlice(void) { @@ -2914,6 +3010,7 @@ _readSlice(void) READ_DONE(); } +#endif /* COMPILING_BINARY_FUNCS */ static SliceTable * _readSliceTable(void) @@ -2941,6 +3038,7 @@ _readVariableResetStmt(void) } +#ifndef COMPILING_BINARY_FUNCS static CreateTrigStmt * _readCreateTrigStmt(void) { @@ -2962,8 +3060,8 @@ _readCreateTrigStmt(void) READ_OID_FIELD(trigOid); READ_DONE(); - } +#endif /* COMPILING_BINARY_FUNCS */ static TableValueExpr * @@ -2987,6 +3085,7 @@ _readAlterTypeStmt(void) READ_DONE(); } +#ifndef COMPILING_BINARY_FUNCS /* * Greenplum Database developers added code to improve performance over the * linear searching that existed in the postgres version of @@ -3309,3 +3408,4 @@ readDatum(bool typbyval) return res; } +#endif /* COMPILING_BINARY_FUNCS */ -- GitLab