From a4999c51afada0022109f10e2296f6268ce661a2 Mon Sep 17 00:00:00 2001 From: Alexey Gordeev Date: Tue, 5 Dec 2023 17:01:00 +0500 Subject: [PATCH] Init foreign modify state early like it's done in 6.6.0 (#73) The changes made in 27b899d96e111480e4f72d98b0323bbbe4021bb6 moved initialization of fdw global state to later phase - from pxfBeginForeignModify() to pxfExecForeignInsert(). This may break another projects which depend on pxf fdw. The patch temporary restores old behavior. --- fdw/pxf_fdw.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/fdw/pxf_fdw.c b/fdw/pxf_fdw.c index 674d9da627..830dd66109 100644 --- a/fdw/pxf_fdw.c +++ b/fdw/pxf_fdw.c @@ -610,6 +610,18 @@ pxfBeginForeignModify(ModifyTableState *mtstate, * external resource in the QD node, when all the actual insertions happen * in the segments. */ + /* begin of temp block */ + /* + * Previously, ri_FdwState initialized here, but not in + * pxfExecForeignInsert(). This was optimized, but unfortunately, there may + * be some external projects that depend on old behavior. Here we do a temp + * fix, which restores old behavior. + */ + if (eflags & EXEC_FLAG_EXPLAIN_ONLY) + return; + if (!resultRelInfo->ri_FdwState) + resultRelInfo->ri_FdwState = InitForeignModify(resultRelInfo->ri_RelationDesc); + /* end of temp block */ } /*