Fix brain fade in DefineIndex(): it was continuing to access the table's relcache entry after having heap_close'd it.  This could lead to misbehavior if a relcache flush wiped out the cache entry meanwhile.  In 8.2 there is a very real risk of CREATE INDEX CONCURRENTLY using the wrong relid for locking and waiting purposes.  I think the bug is only cosmetic in 8.0 and 8.1, because their transgression is limited to using RelationGetRelationName(rel) in an ereport message immediately after heap_close, and there's no way (except with special debugging options) for a cache flush to occur in that interval. Not quite sure that it's cosmetic in 7.4, but seems best to patch anyway.
Fix brain fade in DefineIndex(): it was continuing to access the table's
relcache entry after having heap_close'd it.  This could lead to misbehavior
if a relcache flush wiped out the cache entry meanwhile.  In 8.2 there is a
very real risk of CREATE INDEX CONCURRENTLY using the wrong relid for locking
and waiting purposes.  I think the bug is only cosmetic in 8.0 and 8.1,
because their transgression is limited to using RelationGetRelationName(rel)
in an ereport message immediately after heap_close, and there's no way (except
with special debugging options) for a cache flush to occur in that interval.
Not quite sure that it's cosmetic in 7.4, but seems best to patch anyway.

Found by trying to run the regression tests with CLOBBER_CACHE_ALWAYS enabled.
Maybe we should try to do that on a regular basis --- it's awfully slow,
but perhaps some fast buildfarm machine could do it once in awhile.

Quikling/gpdb,greenplum-db/gpdb,Chibin/gpdb,chrishajas/gpdb,arcivanov/postgres-xl,chrishajas/gpdb,Chibin/gpdb,CraigHarris/gpdb,adam8157/gpdb,cjcjameson/gpdb,jmcatamney/gpdb,CraigHarris/gpdb,0x0FFF/gpdb,pavanvd/postgres-xl,lisakowen/gpdb,zaksoup/gpdb,janebeckman/gpdb,cjcjameson/gpdb,jmcatamney/gpdb,tpostgres-projects/tPostgres,cjcjameson/gpdb,ovr/postgres-xl,Chibin/gpdb,Postgres-XL/Postgres-XL,adam8157/gpdb,Quikling/gpdb,edespino/gpdb,zaksoup/gpdb,rvs/gpdb,jmcatamney/gpdb,chrishajas/gpdb,jmcatamney/gpdb,janebeckman/gpdb,greenplum-db/gpdb,postmind-net/postgres-xl,ahachete/gpdb,Chibin/gpdb,yuanzhao/gpdb,kmjungersen/PostgresXL,kmjungersen/PostgresXL,janebeckman/gpdb,zaksoup/gpdb,xinzweb/gpdb,lintzc/gpdb,pavanvd/postgres-xl,arcivanov/postgres-xl,ovr/postgres-xl,Chibin/gpdb,50wu/gpdb,kaknikhil/gpdb,ashwinstar/gpdb,royc1/gpdb,50wu/gpdb,janebeckman/gpdb,zeroae/postgres-xl,ahachete/gpdb,techdragon/Postgres-XL,ashwinstar/gpdb,janebeckman/gpdb,xuegang/gpdb,lisakowen/gpdb,jmcatamney/gpdb,rvs/gpdb,ovr/postgres-xl,zeroae/postgres-xl,adam8157/gpdb,yuanzhao/gpdb,lisakowen/gpdb,cjcjameson/gpdb,zaksoup/gpdb,postmind-net/postgres-xl,yazun/postgres-xl,0x0FFF/gpdb,kaknikhil/gpdb,50wu/gpdb,CraigHarris/gpdb,0x0FFF/gpdb,Chibin/gpdb,techdragon/Postgres-XL,zaksoup/gpdb,oberstet/postgres-xl,xinzweb/gpdb,janebeckman/gpdb,cjcjameson/gpdb,xinzweb/gpdb,lisakowen/gpdb,kaknikhil/gpdb,lisakowen/gpdb,xuegang/gpdb,ahachete/gpdb,0x0FFF/gpdb,xinzweb/gpdb,ahachete/gpdb,lintzc/gpdb,yuanzhao/gpdb,Postgres-XL/Postgres-XL,postmind-net/postgres-xl,pavanvd/postgres-xl,kaknikhil/gpdb,kmjungersen/PostgresXL,kaknikhil/gpdb,edespino/gpdb,cjcjameson/gpdb,lisakowen/gpdb,rvs/gpdb,oberstet/postgres-xl,zeroae/postgres-xl,kmjungersen/PostgresXL,oberstet/postgres-xl,techdragon/Postgres-XL,50wu/gpdb,xuegang/gpdb,0x0FFF/gpdb,adam8157/gpdb,ahachete/gpdb,ahachete/gpdb,Quikling/gpdb,Chibin/gpdb,yazun/postgres-xl,greenplum-db/gpdb,zaksoup/gpdb,ashwinstar/gpdb,greenplum-db/gpdb,lintzc/gpdb,CraigHarris/gpdb,chrishajas/gpdb,CraigHarris/gpdb,yuanzhao/gpdb,edespino/gpdb,jmcatamney/gpdb,ahachete/gpdb,yuanzhao/gpdb,Chibin/gpdb,yuanzhao/gpdb,lintzc/gpdb,Quikling/gpdb,snaga/postgres-xl,chrishajas/gpdb,royc1/gpdb,royc1/gpdb,postmind-net/postgres-xl,snaga/postgres-xl,rvs/gpdb,greenplum-db/gpdb,xuegang/gpdb,oberstet/postgres-xl,lintzc/gpdb,lintzc/gpdb,techdragon/Postgres-XL,jmcatamney/gpdb,zeroae/postgres-xl,cjcjameson/gpdb,xuegang/gpdb,xinzweb/gpdb,Quikling/gpdb,rvs/gpdb,adam8157/gpdb,chrishajas/gpdb,Quikling/gpdb,chrishajas/gpdb,ashwinstar/gpdb,edespino/gpdb,yazun/postgres-xl,royc1/gpdb,snaga/postgres-xl,kmjungersen/PostgresXL,greenplum-db/gpdb,adam8157/gpdb,arcivanov/postgres-xl,rvs/gpdb,ashwinstar/gpdb,xuegang/gpdb,Quikling/gpdb,rvs/gpdb,xinzweb/gpdb,royc1/gpdb,ovr/postgres-xl,janebeckman/gpdb,kaknikhil/gpdb,xinzweb/gpdb,pavanvd/postgres-xl,techdragon/Postgres-XL,50wu/gpdb,yazun/postgres-xl,zeroae/postgres-xl,Postgres-XL/Postgres-XL,kaknikhil/gpdb,edespino/gpdb,50wu/gpdb,cjcjameson/gpdb,adam8157/gpdb,arcivanov/postgres-xl,greenplum-db/gpdb,xuegang/gpdb,50wu/gpdb,oberstet/postgres-xl,postmind-net/postgres-xl,arcivanov/postgres-xl,kaknikhil/gpdb,ovr/postgres-xl,yuanzhao/gpdb,adam8157/gpdb,rvs/gpdb,rvs/gpdb,yazun/postgres-xl,lisakowen/gpdb,50wu/gpdb,ahachete/gpdb,edespino/gpdb,Quikling/gpdb,tpostgres-projects/tPostgres,zaksoup/gpdb,yuanzhao/gpdb,tpostgres-projects/tPostgres,ashwinstar/gpdb,kaknikhil/gpdb,zaksoup/gpdb,Chibin/gpdb,Postgres-XL/Postgres-XL,snaga/postgres-xl,yuanzhao/gpdb,cjcjameson/gpdb,ashwinstar/gpdb,lintzc/gpdb,royc1/gpdb,lintzc/gpdb,rvs/gpdb,tpostgres-projects/tPostgres,janebeckman/gpdb,edespino/gpdb,0x0FFF/gpdb,jmcatamney/gpdb,xuegang/gpdb,CraigHarris/gpdb,yuanzhao/gpdb,janebeckman/gpdb,CraigHarris/gpdb,royc1/gpdb,0x0FFF/gpdb,chrishajas/gpdb,pavanvd/postgres-xl,royc1/gpdb,kaknikhil/gpdb,tpostgres-projects/tPostgres,CraigHarris/gpdb,arcivanov/postgres-xl,Quikling/gpdb,ashwinstar/gpdb,xinzweb/gpdb,janebeckman/gpdb,Quikling/gpdb,xuegang/gpdb,greenplum-db/gpdb,edespino/gpdb,cjcjameson/gpdb,snaga/postgres-xl,edespino/gpdb,CraigHarris/gpdb,Postgres-XL/Postgres-XL,edespino/gpdb,0x0FFF/gpdb,lintzc/gpdb,lisakowen/gpdb,Chibin/gpdb