X-Git-Url: https://granicus.if.org/sourcecode?a=blobdiff_plain;f=src%2Fbackend%2Fnodes%2Foutfuncs.c;h=02a0f62a53a4e3d06a3ad48d523e959d5d6b2ab7;hb=46c508fbcf98ac334f1e831d21021d731c882fbb;hp=cb94614821da7f5eb272f6b6b1086364cbfa8b59;hpb=e126958c2efdfc2d60b978d1fc7a780ff647e8ad;p=postgresql diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index cb94614821..02a0f62a53 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -23,7 +23,9 @@ #include -#include "foreign/fdwapi.h" +#include "lib/stringinfo.h" +#include "nodes/plannodes.h" +#include "nodes/relation.h" #include "utils/datum.h" @@ -139,7 +141,7 @@ _outToken(StringInfo str, const char *s) static void _outList(StringInfo str, const List *node) { - const ListCell *lc; + const ListCell *lc; appendStringInfoChar(str, '('); @@ -240,6 +242,7 @@ _outPlannedStmt(StringInfo str, const PlannedStmt *node) WRITE_NODE_TYPE("PLANNEDSTMT"); WRITE_ENUM_FIELD(commandType, CmdType); + WRITE_UINT_FIELD(queryId); WRITE_BOOL_FIELD(hasReturning); WRITE_BOOL_FIELD(hasModifyingCTE); WRITE_BOOL_FIELD(canSetTag); @@ -248,7 +251,6 @@ _outPlannedStmt(StringInfo str, const PlannedStmt *node) WRITE_NODE_FIELD(rtable); WRITE_NODE_FIELD(resultRelations); WRITE_NODE_FIELD(utilityStmt); - WRITE_NODE_FIELD(intoClause); WRITE_NODE_FIELD(subplans); WRITE_BITMAPSET_FIELD(rewindPlanIDs); WRITE_NODE_FIELD(rowMarks); @@ -557,18 +559,9 @@ _outForeignScan(StringInfo str, const ForeignScan *node) _outScanInfo(str, (const Scan *) node); - WRITE_BOOL_FIELD(fsSystemCol); - WRITE_NODE_FIELD(fdwplan); -} - -static void -_outFdwPlan(StringInfo str, const FdwPlan *node) -{ - WRITE_NODE_TYPE("FDWPLAN"); - - WRITE_FLOAT_FIELD(startup_cost, "%.2f"); - WRITE_FLOAT_FIELD(total_cost, "%.2f"); + WRITE_NODE_FIELD(fdw_exprs); WRITE_NODE_FIELD(fdw_private); + WRITE_BOOL_FIELD(fsSystemCol); } static void @@ -1468,6 +1461,9 @@ _outFromExpr(StringInfo str, const FromExpr *node) * * Note we do NOT print the parent, else we'd be in infinite recursion. * We can print the parent's relids for identification purposes, though. + * We also do not print the whole of param_info, since it's printed by + * _outRelOptInfo; it's sufficient and less cluttering to print just the + * required outer relids. */ static void _outPathInfo(StringInfo str, const Path *node) @@ -1475,6 +1471,12 @@ _outPathInfo(StringInfo str, const Path *node) WRITE_ENUM_FIELD(pathtype, NodeTag); appendStringInfo(str, " :parent_relids "); _outBitmapset(str, node->parent->relids); + appendStringInfo(str, " :required_outer "); + if (node->param_info) + _outBitmapset(str, node->param_info->ppi_req_outer); + else + _outBitmapset(str, NULL); + WRITE_FLOAT_FIELD(rows, "%.0f"); WRITE_FLOAT_FIELD(startup_cost, "%.2f"); WRITE_FLOAT_FIELD(total_cost, "%.2f"); WRITE_NODE_FIELD(pathkeys); @@ -1515,11 +1517,9 @@ _outIndexPath(StringInfo str, const IndexPath *node) WRITE_NODE_FIELD(indexqualcols); WRITE_NODE_FIELD(indexorderbys); WRITE_NODE_FIELD(indexorderbycols); - WRITE_BOOL_FIELD(isjoininner); WRITE_ENUM_FIELD(indexscandir, ScanDirection); WRITE_FLOAT_FIELD(indextotalcost, "%.2f"); WRITE_FLOAT_FIELD(indexselectivity, "%.4f"); - WRITE_FLOAT_FIELD(rows, "%.0f"); } static void @@ -1530,8 +1530,6 @@ _outBitmapHeapPath(StringInfo str, const BitmapHeapPath *node) _outPathInfo(str, (const Path *) node); WRITE_NODE_FIELD(bitmapqual); - WRITE_BOOL_FIELD(isjoininner); - WRITE_FLOAT_FIELD(rows, "%.0f"); } static void @@ -1573,7 +1571,7 @@ _outForeignPath(StringInfo str, const ForeignPath *node) _outPathInfo(str, (const Path *) node); - WRITE_NODE_FIELD(fdwplan); + WRITE_NODE_FIELD(fdw_private); } static void @@ -1628,7 +1626,6 @@ _outUniquePath(StringInfo str, const UniquePath *node) WRITE_ENUM_FIELD(umethod, UniquePathMethod); WRITE_NODE_FIELD(in_operators); WRITE_NODE_FIELD(uniq_exprs); - WRITE_FLOAT_FIELD(rows, "%.0f"); } static void @@ -1669,7 +1666,6 @@ _outPlannerGlobal(StringInfo str, const PlannerGlobal *node) WRITE_NODE_TYPE("PLANNERGLOBAL"); /* NB: this isn't a complete set of fields */ - WRITE_NODE_FIELD(paramlist); WRITE_NODE_FIELD(subplans); WRITE_BITMAPSET_FIELD(rewindPlanIDs); WRITE_NODE_FIELD(finalrtable); @@ -1677,6 +1673,7 @@ _outPlannerGlobal(StringInfo str, const PlannerGlobal *node) WRITE_NODE_FIELD(resultRelations); WRITE_NODE_FIELD(relationOids); WRITE_NODE_FIELD(invalItems); + WRITE_INT_FIELD(nParamExec); WRITE_UINT_FIELD(lastPHId); WRITE_UINT_FIELD(lastRowMarkId); WRITE_BOOL_FIELD(transientPlan); @@ -1691,6 +1688,8 @@ _outPlannerInfo(StringInfo str, const PlannerInfo *node) WRITE_NODE_FIELD(parse); WRITE_NODE_FIELD(glob); WRITE_UINT_FIELD(query_level); + WRITE_NODE_FIELD(plan_params); + WRITE_BITMAPSET_FIELD(all_baserels); WRITE_NODE_FIELD(join_rel_list); WRITE_INT_FIELD(join_cur_level); WRITE_NODE_FIELD(init_plans); @@ -1701,6 +1700,7 @@ _outPlannerInfo(StringInfo str, const PlannerInfo *node) WRITE_NODE_FIELD(right_join_clauses); WRITE_NODE_FIELD(full_join_clauses); WRITE_NODE_FIELD(join_info_list); + WRITE_NODE_FIELD(lateral_info_list); WRITE_NODE_FIELD(append_rel_list); WRITE_NODE_FIELD(rowMarks); WRITE_NODE_FIELD(placeholder_list); @@ -1715,6 +1715,7 @@ _outPlannerInfo(StringInfo str, const PlannerInfo *node) WRITE_FLOAT_FIELD(limit_tuples, "%.0f"); WRITE_BOOL_FIELD(hasInheritedTarget); WRITE_BOOL_FIELD(hasJoinRTEs); + WRITE_BOOL_FIELD(hasLateralRTEs); WRITE_BOOL_FIELD(hasHavingQual); WRITE_BOOL_FIELD(hasPseudoConstantQuals); WRITE_BOOL_FIELD(hasRecursion); @@ -1733,27 +1734,32 @@ _outRelOptInfo(StringInfo str, const RelOptInfo *node) WRITE_BITMAPSET_FIELD(relids); WRITE_FLOAT_FIELD(rows, "%.0f"); WRITE_INT_FIELD(width); + WRITE_BOOL_FIELD(consider_startup); WRITE_NODE_FIELD(reltargetlist); WRITE_NODE_FIELD(pathlist); + WRITE_NODE_FIELD(ppilist); WRITE_NODE_FIELD(cheapest_startup_path); WRITE_NODE_FIELD(cheapest_total_path); WRITE_NODE_FIELD(cheapest_unique_path); + WRITE_NODE_FIELD(cheapest_parameterized_paths); WRITE_UINT_FIELD(relid); WRITE_UINT_FIELD(reltablespace); WRITE_ENUM_FIELD(rtekind, RTEKind); WRITE_INT_FIELD(min_attr); WRITE_INT_FIELD(max_attr); + WRITE_NODE_FIELD(lateral_vars); + WRITE_BITMAPSET_FIELD(lateral_relids); WRITE_NODE_FIELD(indexlist); WRITE_UINT_FIELD(pages); WRITE_FLOAT_FIELD(tuples, "%.0f"); WRITE_FLOAT_FIELD(allvisfrac, "%.6f"); WRITE_NODE_FIELD(subplan); WRITE_NODE_FIELD(subroot); + WRITE_NODE_FIELD(subplan_params); + /* we don't try to print fdwroutine or fdw_private */ WRITE_NODE_FIELD(baserestrictinfo); WRITE_NODE_FIELD(joininfo); WRITE_BOOL_FIELD(has_eclass_joins); - WRITE_BITMAPSET_FIELD(index_outer_relids); - WRITE_NODE_FIELD(index_inner_paths); } static void @@ -1825,6 +1831,16 @@ _outPathKey(StringInfo str, const PathKey *node) WRITE_BOOL_FIELD(pk_nulls_first); } +static void +_outParamPathInfo(StringInfo str, const ParamPathInfo *node) +{ + WRITE_NODE_TYPE("PARAMPATHINFO"); + + WRITE_BITMAPSET_FIELD(ppi_req_outer); + WRITE_FLOAT_FIELD(ppi_rows, "%.0f"); + WRITE_NODE_FIELD(ppi_clauses); +} + static void _outRestrictInfo(StringInfo str, const RestrictInfo *node) { @@ -1838,6 +1854,7 @@ _outRestrictInfo(StringInfo str, const RestrictInfo *node) WRITE_BOOL_FIELD(pseudoconstant); WRITE_BITMAPSET_FIELD(clause_relids); WRITE_BITMAPSET_FIELD(required_relids); + WRITE_BITMAPSET_FIELD(outer_relids); WRITE_BITMAPSET_FIELD(nullable_relids); WRITE_BITMAPSET_FIELD(left_relids); WRITE_BITMAPSET_FIELD(right_relids); @@ -1854,16 +1871,6 @@ _outRestrictInfo(StringInfo str, const RestrictInfo *node) WRITE_OID_FIELD(hashjoinoperator); } -static void -_outInnerIndexscanInfo(StringInfo str, const 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 _outPlaceHolderVar(StringInfo str, const PlaceHolderVar *node) { @@ -1890,6 +1897,15 @@ _outSpecialJoinInfo(StringInfo str, const SpecialJoinInfo *node) WRITE_NODE_FIELD(join_quals); } +static void +_outLateralJoinInfo(StringInfo str, const LateralJoinInfo *node) +{ + WRITE_NODE_TYPE("LATERALJOININFO"); + + WRITE_UINT_FIELD(lateral_rhs); + WRITE_BITMAPSET_FIELD(lateral_lhs); +} + static void _outAppendRelInfo(StringInfo str, const AppendRelInfo *node) { @@ -1936,7 +1952,7 @@ _outPlannerParamItem(StringInfo str, const PlannerParamItem *node) WRITE_NODE_TYPE("PLANNERPARAMITEM"); WRITE_NODE_FIELD(item); - WRITE_UINT_FIELD(abslevel); + WRITE_INT_FIELD(paramId); } /***************************************************************************** @@ -1945,11 +1961,12 @@ _outPlannerParamItem(StringInfo str, const PlannerParamItem *node) * *****************************************************************************/ +/* + * print the basic stuff of all nodes that inherit from CreateStmt + */ static void -_outCreateStmt(StringInfo str, const CreateStmt *node) +_outCreateStmtInfo(StringInfo str, const CreateStmt *node) { - WRITE_NODE_TYPE("CREATESTMT"); - WRITE_NODE_FIELD(relation); WRITE_NODE_FIELD(tableElts); WRITE_NODE_FIELD(inhRelations); @@ -1961,12 +1978,20 @@ _outCreateStmt(StringInfo str, const CreateStmt *node) WRITE_BOOL_FIELD(if_not_exists); } +static void +_outCreateStmt(StringInfo str, const CreateStmt *node) +{ + WRITE_NODE_TYPE("CREATESTMT"); + + _outCreateStmtInfo(str, (const CreateStmt *) node); +} + static void _outCreateForeignTableStmt(StringInfo str, const CreateForeignTableStmt *node) { WRITE_NODE_TYPE("CREATEFOREIGNTABLESTMT"); - _outCreateStmt(str, (const CreateStmt *) &node->base); + _outCreateStmtInfo(str, (const CreateStmt *) node); WRITE_STRING_FIELD(servername); WRITE_NODE_FIELD(options); @@ -1985,6 +2010,7 @@ _outIndexStmt(StringInfo str, const IndexStmt *node) WRITE_NODE_FIELD(options); WRITE_NODE_FIELD(whereClause); WRITE_NODE_FIELD(excludeOpNames); + WRITE_STRING_FIELD(idxcomment); WRITE_OID_FIELD(indexOid); WRITE_OID_FIELD(oldNode); WRITE_BOOL_FIELD(unique); @@ -2027,12 +2053,12 @@ _outSelectStmt(StringInfo str, const SelectStmt *node) WRITE_NODE_FIELD(groupClause); WRITE_NODE_FIELD(havingClause); WRITE_NODE_FIELD(windowClause); - WRITE_NODE_FIELD(withClause); WRITE_NODE_FIELD(valuesLists); WRITE_NODE_FIELD(sortClause); WRITE_NODE_FIELD(limitOffset); WRITE_NODE_FIELD(limitCount); WRITE_NODE_FIELD(lockingClause); + WRITE_NODE_FIELD(withClause); WRITE_ENUM_FIELD(op, SetOperation); WRITE_BOOL_FIELD(all); WRITE_NODE_FIELD(larg); @@ -2066,9 +2092,9 @@ _outDefElem(StringInfo str, const DefElem *node) } static void -_outInhRelation(StringInfo str, const InhRelation *node) +_outTableLikeClause(StringInfo str, const TableLikeClause *node) { - WRITE_NODE_TYPE("INHRELATION"); + WRITE_NODE_TYPE("TABLELIKECLAUSE"); WRITE_NODE_FIELD(relation); WRITE_UINT_FIELD(options); @@ -2106,7 +2132,7 @@ _outColumnDef(StringInfo str, const ColumnDef *node) WRITE_BOOL_FIELD(is_local); WRITE_BOOL_FIELD(is_not_null); WRITE_BOOL_FIELD(is_from_type); - WRITE_INT_FIELD(storage); + WRITE_CHAR_FIELD(storage); WRITE_NODE_FIELD(raw_default); WRITE_NODE_FIELD(cooked_default); WRITE_NODE_FIELD(collClause); @@ -2171,6 +2197,7 @@ _outQuery(StringInfo str, const Query *node) WRITE_ENUM_FIELD(commandType, CmdType); WRITE_ENUM_FIELD(querySource, QuerySource); + /* we intentionally do not print the queryId field */ WRITE_BOOL_FIELD(canSetTag); /* @@ -2199,7 +2226,6 @@ _outQuery(StringInfo str, const Query *node) appendStringInfo(str, " :utilityStmt <>"); WRITE_INT_FIELD(resultRelation); - WRITE_NODE_FIELD(intoClause); WRITE_BOOL_FIELD(hasAggs); WRITE_BOOL_FIELD(hasWindowFuncs); WRITE_BOOL_FIELD(hasSubLinks); @@ -2352,6 +2378,7 @@ _outRangeTblEntry(StringInfo str, const RangeTblEntry *node) break; } + WRITE_BOOL_FIELD(lateral); WRITE_BOOL_FIELD(inh); WRITE_BOOL_FIELD(inFromCl); WRITE_UINT_FIELD(requiredPerms); @@ -2555,6 +2582,7 @@ _outRangeSubselect(StringInfo str, const RangeSubselect *node) { WRITE_NODE_TYPE("RANGESUBSELECT"); + WRITE_BOOL_FIELD(lateral); WRITE_NODE_FIELD(subquery); WRITE_NODE_FIELD(alias); } @@ -2564,6 +2592,7 @@ _outRangeFunction(StringInfo str, const RangeFunction *node) { WRITE_NODE_TYPE("RANGEFUNCTION"); + WRITE_BOOL_FIELD(lateral); WRITE_NODE_FIELD(funccallnode); WRITE_NODE_FIELD(alias); WRITE_NODE_FIELD(coldeflist); @@ -2598,6 +2627,7 @@ _outConstraint(StringInfo str, const Constraint *node) case CONSTR_CHECK: appendStringInfo(str, "CHECK"); + WRITE_BOOL_FIELD(is_no_inherit); WRITE_NODE_FIELD(raw_expr); WRITE_STRING_FIELD(cooked_expr); break; @@ -2638,6 +2668,7 @@ _outConstraint(StringInfo str, const Constraint *node) WRITE_CHAR_FIELD(fk_matchtype); WRITE_CHAR_FIELD(fk_upd_action); WRITE_CHAR_FIELD(fk_del_action); + WRITE_NODE_FIELD(old_conpfeqop); WRITE_BOOL_FIELD(skip_validation); WRITE_BOOL_FIELD(initially_valid); break; @@ -2756,9 +2787,6 @@ _outNode(StringInfo str, const void *obj) case T_ForeignScan: _outForeignScan(str, obj); break; - case T_FdwPlan: - _outFdwPlan(str, obj); - break; case T_Join: _outJoin(str, obj); break; @@ -3012,18 +3040,21 @@ _outNode(StringInfo str, const void *obj) case T_PathKey: _outPathKey(str, obj); break; + case T_ParamPathInfo: + _outParamPathInfo(str, obj); + break; case T_RestrictInfo: _outRestrictInfo(str, obj); break; - case T_InnerIndexscanInfo: - _outInnerIndexscanInfo(str, obj); - break; case T_PlaceHolderVar: _outPlaceHolderVar(str, obj); break; case T_SpecialJoinInfo: _outSpecialJoinInfo(str, obj); break; + case T_LateralJoinInfo: + _outLateralJoinInfo(str, obj); + break; case T_AppendRelInfo: _outAppendRelInfo(str, obj); break; @@ -3142,8 +3173,8 @@ _outNode(StringInfo str, const void *obj) case T_DefElem: _outDefElem(str, obj); break; - case T_InhRelation: - _outInhRelation(str, obj); + case T_TableLikeClause: + _outTableLikeClause(str, obj); break; case T_LockingClause: _outLockingClause(str, obj);