diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index ea81c361eda67f47add9d19f150fa60b983b28e4..df6af1b898cd1c179d35f1f0593e6e5af8259237 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -2238,7 +2238,9 @@ EvalPlanQualFetchRowMarks(EPQState *epqstate) /* build a temporary HeapTuple control structure */ tuple.t_len = HeapTupleHeaderGetDatumLength(td); ItemPointerSetInvalid(&(tuple.t_self)); - tuple.t_tableOid = InvalidOid; + /* relation might be a foreign table, if so provide tableoid */ + tuple.t_tableOid = getrelid(erm->rti, + epqstate->estate->es_range_table); tuple.t_data = td; /* copy and store tuple */