Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cd8da52

Browse files
author
Markus Nullmeier
committed
adapt custom crossmatch executor node to PostgreSQL 10
Due to changes in the executor of the upcoming PostgreSQL 10, the API changes for set returning expressions in commits 69f4b9c85f168ae006929eec44fc44d569e846b9, ea15e18677fc2eff3135023e27f69ed8821554ed, and b8d7f053c5c2bf2a7e8734fe3327f6a8bc711755 of the PostgreSQL git repository required some adaption in init.c. For details, see the respective commits and especially their commit messages, and also the discussion starting at https://postgr.es/m/[email protected]
1 parent 3a900cc commit cd8da52

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

init.c

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
#include "nodes/extensible.h"
2929
#endif
3030

31+
#if PG_VERSION_NUM >= 100000
32+
#include "utils/regproc.h"
33+
#endif
34+
3135
#include "point.h"
3236
#include "crossmatch.h"
3337

@@ -651,6 +655,14 @@ fetch_next_pair(CrossmatchScanState *scan_state)
651655
return FetchTidPairReady;
652656
}
653657

658+
#if PG_VERSION_NUM < 100000
659+
#define COMPAT_PROJECT_ARG , &isDone
660+
#define COMPAT_QUAL_ARG , false
661+
#else
662+
#define COMPAT_PROJECT_ARG
663+
#define COMPAT_QUAL_ARG
664+
#endif
665+
654666
static TupleTableSlot *
655667
crossmatch_exec(CustomScanState *node)
656668
{
@@ -659,7 +671,11 @@ crossmatch_exec(CustomScanState *node)
659671

660672
for (;;)
661673
{
674+
#if PG_VERSION_NUM < 100000
675+
ExprDoneCond isDone;
676+
662677
if (!node->ss.ps.ps_TupFromTlist)
678+
#endif
663679
{
664680
FetchTidPairState fetch_state;
665681

@@ -675,33 +691,38 @@ crossmatch_exec(CustomScanState *node)
675691

676692
if (node->ss.ps.ps_ProjInfo)
677693
{
678-
ExprDoneCond isDone;
679694
TupleTableSlot *resultSlot;
680695

681696
ResetExprContext(node->ss.ps.ps_ProjInfo->pi_exprContext);
682697

683698
node->ss.ps.ps_ProjInfo->pi_exprContext->ecxt_scantuple = scanSlot;
684-
resultSlot = ExecProject(node->ss.ps.ps_ProjInfo, &isDone);
685-
699+
resultSlot = ExecProject(node->ss.ps.ps_ProjInfo
700+
COMPAT_PROJECT_ARG);
701+
#if PG_VERSION_NUM < 100000
686702
if (isDone != ExprEndResult)
687703
{
688704
node->ss.ps.ps_TupFromTlist = (isDone == ExprMultipleResult);
705+
#endif
689706

690707
/* Check join conditions */
691708
node->ss.ps.ps_ExprContext->ecxt_scantuple = scanSlot;
692-
if (ExecQual(node->ss.ps.qual, node->ss.ps.ps_ExprContext, false))
709+
if (ExecQual(node->ss.ps.qual, node->ss.ps.ps_ExprContext
710+
COMPAT_QUAL_ARG))
693711
return resultSlot;
694712
else
695713
InstrCountFiltered1(node, 1);
714+
#if PG_VERSION_NUM < 100000
696715
}
697716
else
698717
node->ss.ps.ps_TupFromTlist = false;
718+
#endif
699719
}
700720
else
701721
{
702722
/* Check join conditions */
703723
node->ss.ps.ps_ExprContext->ecxt_scantuple = scanSlot;
704-
if (ExecQual(node->ss.ps.qual, node->ss.ps.ps_ExprContext, false))
724+
if (ExecQual(node->ss.ps.qual, node->ss.ps.ps_ExprContext
725+
COMPAT_QUAL_ARG))
705726
return scanSlot;
706727
else
707728
InstrCountFiltered1(node, 1);
@@ -723,8 +744,10 @@ crossmatch_end(CustomScanState *node)
723744
static void
724745
crossmatch_rescan(CustomScanState *node)
725746
{
747+
#if PG_VERSION_NUM < 100000
726748
/* NOTE: nothing to do here? */
727749
node->ss.ps.ps_TupFromTlist = false;
750+
#endif
728751
}
729752

730753
static void

0 commit comments

Comments
 (0)