diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c
index 0c44260..2350de3 100644
*** a/contrib/postgres_fdw/postgres_fdw.c
--- b/contrib/postgres_fdw/postgres_fdw.c
*************** make_tuple_from_result_row(PGresult *res
*** 2965,2971 ****
--- 2965,2974 ----
  	tuple = heap_form_tuple(tupdesc, values, nulls);
  
  	if (ctid)
+ 	{
  		tuple->t_self = *ctid;
+ 		tuple->t_data->t_ctid = *ctid;
+ 	}
  
  	/* Clean up */
  	MemoryContextReset(temp_context);
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index 43d3c44..4c39e06 100644
*** a/src/backend/executor/execMain.c
--- b/src/backend/executor/execMain.c
*************** EvalPlanQualFetchRowMarks(EPQState *epqs
*** 2613,2621 ****
  
  			/* build a temporary HeapTuple control structure */
  			tuple.t_len = HeapTupleHeaderGetDatumLength(td);
- 			ItemPointerSetInvalid(&(tuple.t_self));
  			/* relation might be a foreign table, if so provide tableoid */
  			tuple.t_tableOid = erm->relid;
  			tuple.t_data = td;
  
  			/* copy and store tuple */
--- 2613,2622 ----
  
  			/* build a temporary HeapTuple control structure */
  			tuple.t_len = HeapTupleHeaderGetDatumLength(td);
  			/* relation might be a foreign table, if so provide tableoid */
  			tuple.t_tableOid = erm->relid;
+ 			/* also copy t_ctid in case somebody supplied it */
+ 			tuple.t_self = td->t_ctid;
  			tuple.t_data = td;
  
  			/* copy and store tuple */
