From b26422e3012b68ab23033e0e24da264352afe32f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Wed, 17 Jul 2019 19:39:59 +0000 Subject: [PATCH] ExecInitResult on scanState->customScanState.ss.ps as pg's nodeCustom initializes with TTSOpsVirtual which is incompatible with tuplestore --- src/backend/distributed/executor/citus_custom_scan.c | 5 +++++ src/include/distributed/version_compat.h | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/backend/distributed/executor/citus_custom_scan.c b/src/backend/distributed/executor/citus_custom_scan.c index e320dd2a3..e98de4391 100644 --- a/src/backend/distributed/executor/citus_custom_scan.c +++ b/src/backend/distributed/executor/citus_custom_scan.c @@ -162,6 +162,11 @@ CitusBeginScan(CustomScanState *node, EState *estate, int eflags) MarkCitusInitiatedCoordinatorBackend(); scanState = (CitusScanState *) node; + +#if PG_VERSION_NUM >= 120000 + ExecInitResultSlot(&scanState->customScanState.ss.ps, &TTSOpsMinimalTuple); +#endif + distributedPlan = scanState->distributedPlan; if (distributedPlan->modLevel == ROW_MODIFY_READONLY || distributedPlan->insertSelectSubquery != NULL) diff --git a/src/include/distributed/version_compat.h b/src/include/distributed/version_compat.h index 465122281..b8c7ccb1a 100644 --- a/src/include/distributed/version_compat.h +++ b/src/include/distributed/version_compat.h @@ -264,9 +264,9 @@ RangeVarGetRelidInternal(const RangeVar *relation, LOCKMODE lockmode, uint32 fla #define FileWriteCompat FileWrite #define fcSetArg(fc, n, argval) \ - ((fc)->args[n].isnull = false, (fc)->args[n].value = (argval)) -#define fcSetArgNull(fc, n) \ - ((fc)->args[n].isnull = true, (fc)->args[n].value = (Datum) 0) + (((fc)->args[n].isnull = false), ((fc)->args[n].value = (argval))) + #define fcSetArgNull(fc, n) \ + (((fc)->args[n].isnull = true), ((fc)->args[n].value = (Datum) 0)) #else /* pre PG12 */ #define QTW_EXAMINE_RTES_BEFORE QTW_EXAMINE_RTES