Ensure mark_dummy_rel doesn't create dangling pointers in RelOptInfos.
Ensure mark_dummy_rel doesn't create dangling pointers in RelOptInfos.

When we are doing GEQO join planning, the current memory context is a
short-lived context that will be reset at the end of geqo_eval().  However,
the RelOptInfos for base relations are set up before that and then re-used
across many GEQO cycles.  Hence, any code that modifies a baserel during
join planning has to be careful not to put pointers to the short-lived
context into the baserel struct.  mark_dummy_rel got this wrong, leading to
easy-to-reproduce-once-you-know-how crashes in 8.4, as reported off-list by
Leo Carson of SDSC.  Some improvements made in 9.0 make it difficult to
demonstrate the crash in 9.0 or HEAD; but there's no doubt that there's
still a risk factor here, so patch all branches that have the function.
(Note: 8.3 has a similar function, but it's only applied to joinrels and
thus is not a hazard.)

pavanvd/postgres-xl,postmind-net/postgres-xl,kmjungersen/PostgresXL,zeroae/postgres-xl,xinzweb/gpdb,lisakowen/gpdb,jmcatamney/gpdb,snaga/postgres-xl,ovr/postgres-xl,tpostgres-projects/tPostgres,lisakowen/gpdb,ovr/postgres-xl,snaga/postgres-xl,adam8157/gpdb,kmjungersen/PostgresXL,50wu/gpdb,adam8157/gpdb,50wu/gpdb,techdragon/Postgres-XL,adam8157/gpdb,Postgres-XL/Postgres-XL,techdragon/Postgres-XL,greenplum-db/gpdb,50wu/gpdb,jmcatamney/gpdb,greenplum-db/gpdb,zeroae/postgres-xl,adam8157/gpdb,ashwinstar/gpdb,oberstet/postgres-xl,snaga/postgres-xl,ashwinstar/gpdb,50wu/gpdb,oberstet/postgres-xl,ashwinstar/gpdb,greenplum-db/gpdb,Postgres-XL/Postgres-XL,arcivanov/postgres-xl,Postgres-XL/Postgres-XL,xinzweb/gpdb,xinzweb/gpdb,arcivanov/postgres-xl,oberstet/postgres-xl,postmind-net/postgres-xl,greenplum-db/gpdb,ashwinstar/gpdb,kmjungersen/PostgresXL,techdragon/Postgres-XL,arcivanov/postgres-xl,ashwinstar/gpdb,techdragon/Postgres-XL,lisakowen/gpdb,ashwinstar/gpdb,xinzweb/gpdb,greenplum-db/gpdb,greenplum-db/gpdb,pavanvd/postgres-xl,adam8157/gpdb,50wu/gpdb,jmcatamney/gpdb,zeroae/postgres-xl,xinzweb/gpdb,pavanvd/postgres-xl,lisakowen/gpdb,yazun/postgres-xl,pavanvd/postgres-xl,tpostgres-projects/tPostgres,yazun/postgres-xl,ashwinstar/gpdb,arcivanov/postgres-xl,techdragon/Postgres-XL,xinzweb/gpdb,greenplum-db/gpdb,snaga/postgres-xl,kmjungersen/PostgresXL,lisakowen/gpdb,jmcatamney/gpdb,tpostgres-projects/tPostgres,50wu/gpdb,ovr/postgres-xl,oberstet/postgres-xl,tpostgres-projects/tPostgres,postmind-net/postgres-xl,adam8157/gpdb,lisakowen/gpdb,ovr/postgres-xl,lisakowen/gpdb,ashwinstar/gpdb,lisakowen/gpdb,Postgres-XL/Postgres-XL,xinzweb/gpdb,kmjungersen/PostgresXL,Postgres-XL/Postgres-XL,postmind-net/postgres-xl,tpostgres-projects/tPostgres,yazun/postgres-xl,postmind-net/postgres-xl,adam8157/gpdb,zeroae/postgres-xl,adam8157/gpdb,snaga/postgres-xl,arcivanov/postgres-xl,oberstet/postgres-xl,yazun/postgres-xl,arcivanov/postgres-xl,yazun/postgres-xl,jmcatamney/gpdb,50wu/gpdb,jmcatamney/gpdb,zeroae/postgres-xl,50wu/gpdb,jmcatamney/gpdb,greenplum-db/gpdb,xinzweb/gpdb,ovr/postgres-xl,jmcatamney/gpdb,pavanvd/postgres-xl