📄 outfuncs.c
字号:
WRITE_NODE_FIELD(arg); WRITE_NODE_FIELD(typename);}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_outQuery(StringInfo str, Query *node){ WRITE_NODE_TYPE("QUERY"); WRITE_ENUM_FIELD(commandType, CmdType); WRITE_ENUM_FIELD(querySource, QuerySource); WRITE_BOOL_FIELD(canSetTag); /* * Hack to work around missing outfuncs routines for a lot of the * utility-statement node types. (The only one we actually *need* for * rules support is NotifyStmt.) Someday we ought to support 'em all, but * for the meantime do this to avoid getting lots of warnings when running * with debug_print_parse on. */ if (node->utilityStmt) { switch (nodeTag(node->utilityStmt)) { case T_CreateStmt: case T_IndexStmt: case T_NotifyStmt: case T_DeclareCursorStmt: WRITE_NODE_FIELD(utilityStmt); break; default: appendStringInfo(str, " :utilityStmt ?"); break; } } else appendStringInfo(str, " :utilityStmt <>"); WRITE_INT_FIELD(resultRelation); WRITE_NODE_FIELD(into); WRITE_BOOL_FIELD(hasAggs); WRITE_BOOL_FIELD(hasSubLinks); WRITE_NODE_FIELD(rtable); WRITE_NODE_FIELD(jointree); WRITE_NODE_FIELD(rowMarks); WRITE_BOOL_FIELD(forUpdate); WRITE_BOOL_FIELD(rowNoWait); WRITE_NODE_FIELD(targetList); WRITE_NODE_FIELD(groupClause); WRITE_NODE_FIELD(havingQual); WRITE_NODE_FIELD(distinctClause); WRITE_NODE_FIELD(sortClause); WRITE_NODE_FIELD(limitOffset); WRITE_NODE_FIELD(limitCount); WRITE_NODE_FIELD(setOperations); WRITE_NODE_FIELD(resultRelations);}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_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);}static void_outRangeTblEntry(StringInfo str, RangeTblEntry *node){ WRITE_NODE_TYPE("RTE"); /* put alias + eref first to make dump more legible */ WRITE_NODE_FIELD(alias); WRITE_NODE_FIELD(eref); WRITE_ENUM_FIELD(rtekind, RTEKind); switch (node->rtekind) { case RTE_RELATION: case RTE_SPECIAL: WRITE_OID_FIELD(relid); break; case RTE_SUBQUERY: WRITE_NODE_FIELD(subquery); break; case RTE_FUNCTION: WRITE_NODE_FIELD(funcexpr); WRITE_NODE_FIELD(coldeflist); break; case RTE_JOIN: WRITE_ENUM_FIELD(jointype, JoinType); WRITE_NODE_FIELD(joinaliasvars); break; default: elog(ERROR, "unrecognized RTE kind: %d", (int) node->rtekind); break; } WRITE_BOOL_FIELD(inh); WRITE_BOOL_FIELD(inFromCl); WRITE_UINT_FIELD(requiredPerms); WRITE_OID_FIELD(checkAsUser);}static void_outAExpr(StringInfo str, A_Expr *node){ WRITE_NODE_TYPE("AEXPR"); switch (node->kind) { case AEXPR_OP: appendStringInfo(str, " "); WRITE_NODE_FIELD(name); break; case AEXPR_AND: appendStringInfo(str, " AND"); break; case AEXPR_OR: appendStringInfo(str, " OR"); break; case AEXPR_NOT: appendStringInfo(str, " NOT"); break; case AEXPR_OP_ANY: appendStringInfo(str, " "); WRITE_NODE_FIELD(name); appendStringInfo(str, " ANY "); break; case AEXPR_OP_ALL: appendStringInfo(str, " "); WRITE_NODE_FIELD(name); appendStringInfo(str, " ALL "); break; case AEXPR_DISTINCT: appendStringInfo(str, " DISTINCT "); WRITE_NODE_FIELD(name); break; case AEXPR_NULLIF: appendStringInfo(str, " NULLIF "); WRITE_NODE_FIELD(name); break; case AEXPR_OF: appendStringInfo(str, " OF "); WRITE_NODE_FIELD(name); break; default: appendStringInfo(str, " ??"); break; } WRITE_NODE_FIELD(lexpr); WRITE_NODE_FIELD(rexpr);}static void_outValue(StringInfo str, Value *value){ switch (value->type) { case T_Integer: appendStringInfo(str, "%ld", value->val.ival); break; case T_Float: /* * We assume the value is a valid numeric literal and so does not * need quoting. */ appendStringInfoString(str, value->val.str); break; case T_String: appendStringInfoChar(str, '"'); _outToken(str, value->val.str); appendStringInfoChar(str, '"'); break; case T_BitString: /* internal representation already has leading 'b' */ appendStringInfoString(str, value->val.str); break; default: elog(ERROR, "unrecognized node type: %d", (int) value->type); break; }}static void_outColumnRef(StringInfo str, ColumnRef *node){ WRITE_NODE_TYPE("COLUMNREF"); WRITE_NODE_FIELD(fields);}static void_outParamRef(StringInfo str, ParamRef *node){ WRITE_NODE_TYPE("PARAMREF"); WRITE_INT_FIELD(number);}static void_outAConst(StringInfo str, A_Const *node){ WRITE_NODE_TYPE("A_CONST"); _outValue(str, &(node->val)); WRITE_NODE_FIELD(typename);}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);}static void_outConstraint(StringInfo str, Constraint *node){ WRITE_NODE_TYPE("CONSTRAINT"); WRITE_STRING_FIELD(name); appendStringInfo(str, " :contype "); switch (node->contype) { case CONSTR_PRIMARY: appendStringInfo(str, "PRIMARY_KEY"); WRITE_NODE_FIELD(keys); WRITE_STRING_FIELD(indexspace); break; case CONSTR_UNIQUE: appendStringInfo(str, "UNIQUE"); WRITE_NODE_FIELD(keys); WRITE_STRING_FIELD(indexspace); break; case CONSTR_CHECK: appendStringInfo(str, "CHECK"); WRITE_NODE_FIELD(raw_expr); WRITE_STRING_FIELD(cooked_expr); break; case CONSTR_DEFAULT: appendStringInfo(str, "DEFAULT"); WRITE_NODE_FIELD(raw_expr); WRITE_STRING_FIELD(cooked_expr); break; case CONSTR_NOTNULL: appendStringInfo(str, "NOT_NULL"); break; default: appendStringInfo(str, "<unrecognized_constraint>"); break; }}static void_outFkConstraint(StringInfo str, FkConstraint *node){ WRITE_NODE_TYPE("FKCONSTRAINT"); WRITE_STRING_FIELD(constr_name); 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);}/* * _outNode - * converts a Node into ascii string and append it to 'str' */static void_outNode(StringInfo str, void *obj){ if (obj == NULL) appendStringInfo(str, "<>"); else if (IsA(obj, List) ||IsA(obj, IntList) || IsA(obj, OidList)) _outList(str, obj); else if (IsA(obj, Integer) || IsA(obj, Float) || IsA(obj, String) || IsA(obj, BitString)) { /* nodeRead does not want to see { } around these! */ _outValue(str, obj); } else { appendStringInfoChar(str, '{'); switch (nodeTag(obj)) { case T_Plan: _outPlan(str, obj); break; case T_Result: _outResult(str, obj); break; case T_Append: _outAppend(str, obj); break; case T_BitmapAnd: _outBitmapAnd(str, obj); break; case T_BitmapOr: _outBitmapOr(str, obj); break; case T_Scan: _outScan(str, obj); break; case T_SeqScan: _outSeqScan(str, obj); break; case T_IndexScan: _outIndexScan(str, obj); break; case T_BitmapIndexScan: _outBitmapIndexScan(str, obj); break; case T_BitmapHeapScan: _outBitmapHeapScan(str, obj); break; case T_TidScan: _outTidScan(str, obj); break; case T_SubqueryScan: _outSubqueryScan(str, obj); break; case T_FunctionScan: _outFunctionScan(str, obj); break; case T_Join: _outJoin(str, obj); break; case T_NestLoop: _outNestLoop(str, obj); break; case T_MergeJoin: _outMergeJoin(str, obj); break; case T_HashJoin: _outHashJoin(str, obj); break; case T_Agg: _outAgg(str, obj); break; case T_Group: _outGroup(str, obj); break; case T_Material: _outMaterial(str, obj); break; case T_Sort: _outSort(str, obj); break; case T_Unique: _outUnique(str, obj); break; case T_SetOp: _outSetOp(str, obj); break; case T_Limit: _outLimit(str, obj); break; case T_Hash: _outHash(str, obj); break; case T_Alias: _outAlias(str, obj); break; case T_RangeVar: _outRangeVar(str, obj); break; case T_Var: _outVar(str, obj); break; case T_Const: _outConst(str, obj); break; case T_Param: _outParam(str, obj); break; case T_Aggref: _outAggref(str, obj); break; case T_ArrayRef: _outArrayRef(str, obj); break; case T_FuncExpr: _outFuncExpr(str, obj); break; case T_OpExpr: _outOpExpr(str, obj); break; case T_DistinctExpr: _outDistinctExpr(str, obj); break; case T_ScalarArrayOpExpr: _outScalarArrayOpExpr(str, obj); break; case T_BoolExpr: _outBoolExpr(str, obj); break; case T_SubLink: _outSubLink(str, obj); break; case T_SubPlan: _outSubPlan(str, obj); break; case T_FieldSelect: _outFieldSelect(str, obj); break; case T_FieldStore: _outFieldStore(str, obj); break; case T_RelabelType: _outRelabelType(str, obj); break; case T_ConvertRowtypeExpr: _outConvertRowtypeExpr(str, obj); break; case T_CaseExpr: _outCaseExpr(str, obj); break; case T_CaseWhen: _outCaseWhen(str, obj); break; case T_CaseTestExpr: _outCaseTestExpr(str, obj); break; case T_ArrayExpr: _outArrayExpr(str, obj); break; case T_RowExpr: _outRowExpr(str, obj); break; case T_CoalesceExpr: _outCoalesceExpr(str, obj); break; case T_MinMaxExpr: _outMinMaxExpr(str, obj); break; case T_NullIfExpr: _outNullIfExpr(str, obj); break; case T_NullTest: _outNullTest(str, obj); break; case T_BooleanTest: _outBooleanTest(str, obj); break; case T_CoerceToDomain: _outCoerceToDomain(str, obj); break; case T_CoerceToDomainValue: _outCoerceToDomainValue(str, obj); break; case T_SetToDefault: _outSetToDefault(str, obj); break; case T_TargetEntry: _outTargetEntry(str, obj); break; case T_RangeTblRef: _outRangeTblRef(str, obj); break; case T_JoinExpr: _outJoinExpr(str, obj); break; case T_FromExpr: _outFromExpr(str, obj); break; case T_Path: _outPath(str, obj); break; case T_IndexPath: _outIndexPath(str, obj); break; case T_BitmapHeapPath: _outBitmapHeapPath(str, obj); break; case T_BitmapAndPath: _outBitmapAndPath(str, obj); break; case T_BitmapOrPath: _outBitmapOrPath(str, obj); break; case T_TidPath: _outTidPath(str, obj); break; case T_AppendPath: _outAppendPath(str, obj); break; case T_ResultPath: _outResultPath(str, obj); break; case T_MaterialPath: _outMaterialPath(str, obj); break; case T_UniquePath: _outUniquePath(str, obj); break; case T_NestPath: _outNestPath(str, obj); break; case T_MergePath: _outMergePath(str, obj); break; case T_HashPath: _outHashPath(str, obj); break; case T_PlannerInfo: _outPlannerInfo(str, obj); break; case T_RelOptInfo: _outRelOptInfo(str, obj); break; case T_IndexOptInfo: _outIndexOptInfo(str, obj); break; case T_PathKeyItem: _outPathKeyItem(str, obj); break; case T_RestrictInfo: _outRestrictInfo(str, obj); break; case T_InnerIndexscanInfo: _outInnerIndexscanInfo(str, obj); break; case T_InClauseInfo: _outInClauseInfo(str, obj); break; case T_CreateStmt: _outCreateStmt(str, obj); break; case T_IndexStmt: _outIndexStmt(str, obj); break; case T_NotifyStmt: _outNotifyStmt(str, obj); break; case T_DeclareCursorStmt: _outDeclareCursorStmt(str, obj); break; case T_SelectStmt: _outSelectStmt(str, obj); break; case T_ColumnDef: _outColumnDef(str, obj); break; case T_TypeName: _outTypeName(str, obj); break; case T_TypeCast: _outTypeCast(str, obj); break; case T_IndexElem: _outIndexElem(str, obj); break; case T_Query: _outQuery(str, obj); break; case T_SortClause: _outSortClause(str, obj); break; case T_GroupClause: _outGroupClause(str, obj); break; case T_SetOperationStmt: _outSetOperationStmt(str, obj); break; case T_RangeTblEntry: _outRangeTblEntry(str, obj); break; case T_A_Expr: _outAExpr(str, obj); break; case T_ColumnRef: _outColumnRef(str, obj); break; case T_ParamRef: _outParamRef(str, obj); break; case T_A_Const: _outAConst(str, obj); break; case T_A_Indices: _outA_Indices(str, obj); break; case T_A_Indirection: _outA_Indirection(str, obj); break; case T_ResTarget: _outResTarget(str, obj); break; case T_Constraint: _outConstraint(str, obj); break; case T_FkConstraint: _outFkConstraint(str, obj); break; case T_FuncCall: _outFuncCall(str, obj); break; case T_DefElem: _outDefElem(str, obj); break; case T_LockingClause: _outLockingClause(str, obj); break; default: /* * This should be an ERROR, but it's too useful to be able to * dump structures that _outNode only understands part of. */ elog(WARNING, "could not dump unrecognized node type: %d", (int) nodeTag(obj)); break; } appendStringInfoChar(str, '}'); }}/* * nodeToString - * returns the ascii representation of the Node as a palloc'd string */char *nodeToString(void *obj){ StringInfoData str; /* see stringinfo.h for an explanation of this maneuver */ initStringInfo(&str); _outNode(&str, obj); return str.data;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -