Ensure tableoid reads correctly in EvalPlanQual-manufactured tuples.
Ensure tableoid reads correctly in EvalPlanQual-manufactured tuples.

The ROW_MARK_COPY path in EvalPlanQualFetchRowMarks() was just setting
tableoid to InvalidOid, I think on the assumption that the referenced
RTE must be a subquery or other case without a meaningful OID.  However,
foreign tables also use this code path, and they do have meaningful
table OIDs; so failure to set the tuple field can lead to user-visible
misbehavior.  Fix that by fetching the appropriate OID from the range
table.

There's still an issue about whether CTID can ever have a meaningful
value in this case; at least with postgres_fdw foreign tables, it does.
But that is a different problem that seems to require a significantly
different patch --- it's debatable whether postgres_fdw really wants to
use this code path at all.

Simplified version of a patch by Etsuro Fujita, who also noted the
problem to begin with.  The issue can be demonstrated in all versions
having FDWs, so back-patch to 9.1.

ovr/postgres-xl,ovr/postgres-xl,zeroae/postgres-xl,ovr/postgres-xl,50wu/gpdb,xinzweb/gpdb,50wu/gpdb,Postgres-XL/Postgres-XL,pavanvd/postgres-xl,ashwinstar/gpdb,ovr/postgres-xl,jmcatamney/gpdb,adam8157/gpdb,50wu/gpdb,ovr/postgres-xl,zeroae/postgres-xl,xinzweb/gpdb,ashwinstar/gpdb,lisakowen/gpdb,jmcatamney/gpdb,yazun/postgres-xl,lisakowen/gpdb,ashwinstar/gpdb,50wu/gpdb,xinzweb/gpdb,50wu/gpdb,greenplum-db/gpdb,oberstet/postgres-xl,greenplum-db/gpdb,jmcatamney/gpdb,oberstet/postgres-xl,adam8157/gpdb,ashwinstar/gpdb,greenplum-db/gpdb,pavanvd/postgres-xl,xinzweb/gpdb,techdragon/Postgres-XL,greenplum-db/gpdb,zeroae/postgres-xl,greenplum-db/gpdb,yazun/postgres-xl,techdragon/Postgres-XL,Postgres-XL/Postgres-XL,greenplum-db/gpdb,oberstet/postgres-xl,lisakowen/gpdb,jmcatamney/gpdb,pavanvd/postgres-xl,xinzweb/gpdb,yazun/postgres-xl,Postgres-XL/Postgres-XL,techdragon/Postgres-XL,jmcatamney/gpdb,yazun/postgres-xl,yazun/postgres-xl,lisakowen/gpdb,50wu/gpdb,jmcatamney/gpdb,greenplum-db/gpdb,lisakowen/gpdb,zeroae/postgres-xl,techdragon/Postgres-XL,lisakowen/gpdb,pavanvd/postgres-xl,ashwinstar/gpdb,Postgres-XL/Postgres-XL,zeroae/postgres-xl,adam8157/gpdb,jmcatamney/gpdb,jmcatamney/gpdb,50wu/gpdb,Postgres-XL/Postgres-XL,xinzweb/gpdb,lisakowen/gpdb,50wu/gpdb,xinzweb/gpdb,pavanvd/postgres-xl,xinzweb/gpdb,ashwinstar/gpdb,adam8157/gpdb,greenplum-db/gpdb,ashwinstar/gpdb,lisakowen/gpdb,oberstet/postgres-xl,adam8157/gpdb,adam8157/gpdb,adam8157/gpdb,ashwinstar/gpdb,techdragon/Postgres-XL,adam8157/gpdb,oberstet/postgres-xl