From 77b7658d86e5dd397e36161886b761884a8c0286 Mon Sep 17 00:00:00 2001 From: nnuanyang Date: Mon, 17 Apr 2023 18:52:30 -0700 Subject: [PATCH] add copyCreateTrigStmt funcSource copy --- src/common/backend/nodes/copyfuncs.cpp | 14 +++++++++++++- src/common/backend/nodes/equalfuncs.cpp | 11 ++++++++++- src/common/backend/nodes/nodes.cpp | 3 ++- src/include/nodes/nodes.h | 3 ++- src/include/nodes/parsenodes_common.h | 1 + 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/common/backend/nodes/copyfuncs.cpp b/src/common/backend/nodes/copyfuncs.cpp index 8dedb799e8..15acdadf44 100644 --- a/src/common/backend/nodes/copyfuncs.cpp +++ b/src/common/backend/nodes/copyfuncs.cpp @@ -4552,6 +4552,15 @@ static IndexHintDefinition* _copyIndexHintDefinition(const IndexHintDefinition* return newnode; } +static FunctionSources* _copyFunctionSources(const FunctionSources* from) +{ + FunctionSources* newnode = makeNode(FunctionSources); + COPY_STRING_FIELD(headerSrc); + COPY_STRING_FIELD(bodySrc); + + return newnode; +} + static SkewRelInfo* _copySkewRelInfo(const SkewRelInfo* from) { SkewRelInfo* newnode = makeNode(SkewRelInfo); @@ -6260,7 +6269,7 @@ static CreateTrigStmt* _copyCreateTrigStmt(const CreateTrigStmt* from) COPY_STRING_FIELD(trgordername); COPY_SCALAR_FIELD(is_follows); COPY_STRING_FIELD(schemaname); - + return newnode; } @@ -8686,6 +8695,9 @@ void* copyObject(const void* from) case T_IndexHintDefinition: retval = _copyIndexHintDefinition((IndexHintDefinition *)from); break; + case T_FunctionSources: + retval = _copyFunctionSources((FunctionSources *)from); + break; default: ereport(ERROR, (errcode(ERRCODE_UNRECOGNIZED_NODE_TYPE), errmsg("copyObject: unrecognized node type: %d", (int)nodeTag(from)))); diff --git a/src/common/backend/nodes/equalfuncs.cpp b/src/common/backend/nodes/equalfuncs.cpp index 32c8b1dd02..5da26cb5da 100644 --- a/src/common/backend/nodes/equalfuncs.cpp +++ b/src/common/backend/nodes/equalfuncs.cpp @@ -2155,6 +2155,13 @@ static bool _equalIndexHintRelationData (const IndexHintRelationData* a, const I return true; } +static bool _equalFunctionSources(const FunctionSources* a, const FunctionSources* b) +{ + COMPARE_STRING_FIELD(headerSrc); + COMPARE_STRING_FIELD(bodySrc); + return true; +} + static bool _equalCreatePolicyLabelStmt(const CreatePolicyLabelStmt* a, const CreatePolicyLabelStmt* b) { COMPARE_SCALAR_FIELD(if_not_exists); @@ -4435,7 +4442,9 @@ bool equal(const void* a, const void* b) case T_IndexHintRelationData: retval = _equalIndexHintRelationData((IndexHintRelationData *)a, (IndexHintRelationData *)b); break; - + case T_FunctionSources: + retval = _equalFunctionSources((const FunctionSources *)a, (const FunctionSources *)b); + break; default: ereport(ERROR, diff --git a/src/common/backend/nodes/nodes.cpp b/src/common/backend/nodes/nodes.cpp index e7a4b62c08..e4e8fc0c7f 100755 --- a/src/common/backend/nodes/nodes.cpp +++ b/src/common/backend/nodes/nodes.cpp @@ -604,7 +604,8 @@ static const TagStr g_tagStrArr[] = {{T_Invalid, "Invalid"}, {T_SetVariableExpr, "SetVariableExpr"}, {T_VariableMultiSetStmt, "VariableMultiSetStmt"}, {T_IndexHintDefinition, "IndexHintDefinition"}, - {T_IndexHintRelationData, "IndexHintRelationData"} + {T_IndexHintRelationData, "IndexHintRelationData"}, + {T_FunctionSources, "FunctionSources"} }; char* nodeTagToString(NodeTag tag) diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h index 9136dbb9a9..8517edf4be 100755 --- a/src/include/nodes/nodes.h +++ b/src/include/nodes/nodes.h @@ -827,7 +827,8 @@ typedef enum NodeTag { T_CentroidPoint, T_UserSetElem, T_UserVar, - T_CharsetCollateOptions + T_CharsetCollateOptions, + T_FunctionSources } NodeTag; /* if you add to NodeTag also need to add nodeTagToString */ diff --git a/src/include/nodes/parsenodes_common.h b/src/include/nodes/parsenodes_common.h index 043c660eab..1061f6ff3d 100644 --- a/src/include/nodes/parsenodes_common.h +++ b/src/include/nodes/parsenodes_common.h @@ -2223,6 +2223,7 @@ typedef struct CreateFunctionStmt { } CreateFunctionStmt; typedef struct FunctionSources { + NodeTag type; char* headerSrc; char* bodySrc; } FunctionSources; -- Gitee