Rearrange code in ExecInitBitmapHeapScan so that we don't initialize the child plan nodes until we have acquired lock on the relation to scan. The relative order of initialization of plan nodes isn't real important in other cases, but it's critical here because one is supposed to lock a relation before its indexes, not vice versa.  The original coding was at least vulnerable to deadlock against DROP INDEX, and perhaps worse things.
Rearrange code in ExecInitBitmapHeapScan so that we don't initialize the
child plan nodes until we have acquired lock on the relation to scan.
The relative order of initialization of plan nodes isn't real important in
other cases, but it's critical here because one is supposed to lock a
relation before its indexes, not vice versa.  The original coding was at
least vulnerable to deadlock against DROP INDEX, and perhaps worse things.

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