Skip to content

Commit 3fb2583

Browse files
author
Maksim Milyutin
committed
Add compat version of ExecBuildProjectionInfo
1 parent 9f92153 commit 3fb2583

File tree

3 files changed

+29
-17
lines changed

3 files changed

+29
-17
lines changed

src/hooks.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,8 +759,8 @@ pathman_relcache_hook(Datum arg, Oid relid)
759759
/*
760760
* Utility function invoker hook.
761761
*/
762-
#if PG_VERSION_NUM >= 100000
763762
void
763+
#if PG_VERSION_NUM >= 100000
764764
pathman_process_utility_hook(PlannedStmt *pstmt,
765765
const char *queryString,
766766
ProcessUtilityContext context,
@@ -770,7 +770,6 @@ pathman_process_utility_hook(PlannedStmt *pstmt,
770770
{
771771
Node *parsetree = pstmt->utilityStmt;
772772
#else
773-
void
774773
pathman_process_utility_hook(Node *parsetree,
775774
const char *queryString,
776775
ProcessUtilityContext context,

src/include/compat/pg_compat.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,23 @@ extern void create_plain_partial_paths(PlannerInfo *root,
184184
#endif
185185

186186

187+
/*
188+
* ExecBuildProjectionInfo
189+
*/
190+
#if PG_VERSION_NUM >= 100000
191+
#define ExecBuildProjectionInfoCompat(targetList, econtext, resultSlot, \
192+
ownerPlanState, inputDesc) \
193+
ExecBuildProjectionInfo((targetList), (econtext), (resultSlot), \
194+
(ownerPlanState), (inputDesc))
195+
#elif PG_VERSION_NUM >= 90500
196+
#define ExecBuildProjectionInfoCompat(targetList, econtext, resultSlot, \
197+
ownerPlanState, inputDesc) \
198+
ExecBuildProjectionInfo((List *) ExecInitExpr((Expr *) (targetList), \
199+
(ownerPlanState)), \
200+
(econtext), (resultSlot), (inputDesc))
201+
#endif
202+
203+
187204
/*
188205
* ExecEvalExpr
189206
*

src/partition_filter.c

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,7 @@ prepare_rri_returning_for_insert(EState *estate,
783783
ResultRelInfo *child_rri,
784784
*parent_rri;
785785
Index parent_rt_idx;
786+
TupleTableSlot *result_slot;
786787

787788
/* We don't need to do anything ff there's no map */
788789
if (!rri_holder->tuple_map)
@@ -809,23 +810,18 @@ prepare_rri_returning_for_insert(EState *estate,
809810
list_make2(makeInteger(parent_rt_idx),
810811
rri_holder));
811812

812-
/* Build new projection info */
813+
/* Specify tuple slot where will be place projection result in */
813814
#if PG_VERSION_NUM >= 100000
814-
child_rri->ri_projectReturning =
815-
ExecBuildProjectionInfo((List *) ExecInitExpr((Expr *) returning_list,
816-
/* HACK: no PlanState */ NULL),
817-
pfstate->tup_convert_econtext,
818-
parent_rri->ri_projectReturning->pi_state.resultslot,
819-
(PlanState *) pfstate,
820-
RelationGetDescr(child_rri->ri_RelationDesc));
821-
#else
822-
child_rri->ri_projectReturning =
823-
ExecBuildProjectionInfo((List *) ExecInitExpr((Expr *) returning_list,
824-
/* HACK: no PlanState */ NULL),
825-
pfstate->tup_convert_econtext,
826-
parent_rri->ri_projectReturning->pi_slot,
827-
RelationGetDescr(child_rri->ri_RelationDesc));
815+
result_slot = parent_rri->ri_projectReturning->pi_state.resultslot;
816+
#elif PG_VERSION_NUM >= 90500
817+
result_slot = parent_rri->ri_projectReturning->pi_slot;
828818
#endif
819+
820+
/* Build new projection info */
821+
child_rri->ri_projectReturning =
822+
ExecBuildProjectionInfoCompat(returning_list, pfstate->tup_convert_econtext,
823+
result_slot, NULL /* HACK: no PlanState */,
824+
RelationGetDescr(child_rri->ri_RelationDesc));
829825
}
830826

831827
/* Prepare FDW access structs */

0 commit comments

Comments
 (0)