@@ -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