Avoid sharing subpath list structure when flattening nested AppendRels.
Avoid sharing subpath list structure when flattening nested AppendRels.

In some situations the original coding led to corrupting the child AppendRel's
subpaths list, effectively adding other members of the parent's list to it.
This was usually masked because we never made any further use of the child's
list, but given the right combination of circumstances, we could do so.  The
visible symptom would be a relation getting scanned twice, as in bug #5673
from David Schmitt.

Backpatch to 8.2, which is as far back as the risky coding appears.  The
example submitted by David only fails in 8.4 and later, but I'm not convinced
that there aren't any even-more-obscure cases where 8.2 and 8.3 would fail.

janebeckman/gpdb,ahachete/gpdb,ahachete/gpdb,kaknikhil/gpdb,0x0FFF/gpdb,edespino/gpdb,ashwinstar/gpdb,ahachete/gpdb,jmcatamney/gpdb,Chibin/gpdb,chrishajas/gpdb,ashwinstar/gpdb,xuegang/gpdb,lisakowen/gpdb,xinzweb/gpdb,janebeckman/gpdb,CraigHarris/gpdb,royc1/gpdb,greenplum-db/gpdb,CraigHarris/gpdb,jmcatamney/gpdb,greenplum-db/gpdb,lintzc/gpdb,rvs/gpdb,Quikling/gpdb,janebeckman/gpdb,edespino/gpdb,CraigHarris/gpdb,edespino/gpdb,CraigHarris/gpdb,0x0FFF/gpdb,zaksoup/gpdb,lintzc/gpdb,ashwinstar/gpdb,rvs/gpdb,xuegang/gpdb,chrishajas/gpdb,0x0FFF/gpdb,xinzweb/gpdb,ahachete/gpdb,yuanzhao/gpdb,ahachete/gpdb,Chibin/gpdb,Quikling/gpdb,cjcjameson/gpdb,lintzc/gpdb,xinzweb/gpdb,0x0FFF/gpdb,Quikling/gpdb,ashwinstar/gpdb,edespino/gpdb,0x0FFF/gpdb,janebeckman/gpdb,adam8157/gpdb,adam8157/gpdb,Quikling/gpdb,xuegang/gpdb,ahachete/gpdb,lintzc/gpdb,kaknikhil/gpdb,yuanzhao/gpdb,edespino/gpdb,cjcjameson/gpdb,ashwinstar/gpdb,lintzc/gpdb,adam8157/gpdb,rvs/gpdb,chrishajas/gpdb,Chibin/gpdb,zaksoup/gpdb,royc1/gpdb,lisakowen/gpdb,50wu/gpdb,janebeckman/gpdb,royc1/gpdb,royc1/gpdb,xinzweb/gpdb,lisakowen/gpdb,xinzweb/gpdb,Chibin/gpdb,rvs/gpdb,greenplum-db/gpdb,adam8157/gpdb,CraigHarris/gpdb,ashwinstar/gpdb,yuanzhao/gpdb,xuegang/gpdb,royc1/gpdb,ahachete/gpdb,adam8157/gpdb,jmcatamney/gpdb,adam8157/gpdb,xinzweb/gpdb,Quikling/gpdb,cjcjameson/gpdb,lisakowen/gpdb,50wu/gpdb,xuegang/gpdb,lisakowen/gpdb,rvs/gpdb,Chibin/gpdb,CraigHarris/gpdb,rvs/gpdb,lisakowen/gpdb,greenplum-db/gpdb,Quikling/gpdb,cjcjameson/gpdb,xinzweb/gpdb,adam8157/gpdb,kaknikhil/gpdb,xuegang/gpdb,janebeckman/gpdb,ahachete/gpdb,cjcjameson/gpdb,zaksoup/gpdb,yuanzhao/gpdb,cjcjameson/gpdb,lisakowen/gpdb,Chibin/gpdb,kaknikhil/gpdb,edespino/gpdb,janebeckman/gpdb,zaksoup/gpdb,greenplum-db/gpdb,royc1/gpdb,50wu/gpdb,jmcatamney/gpdb,kaknikhil/gpdb,adam8157/gpdb,Chibin/gpdb,zaksoup/gpdb,chrishajas/gpdb,zaksoup/gpdb,jmcatamney/gpdb,greenplum-db/gpdb,Chibin/gpdb,0x0FFF/gpdb,chrishajas/gpdb,ashwinstar/gpdb,kaknikhil/gpdb,50wu/gpdb,chrishajas/gpdb,xinzweb/gpdb,jmcatamney/gpdb,50wu/gpdb,yuanzhao/gpdb,janebeckman/gpdb,edespino/gpdb,50wu/gpdb,xuegang/gpdb,edespino/gpdb,ashwinstar/gpdb,lisakowen/gpdb,kaknikhil/gpdb,rvs/gpdb,greenplum-db/gpdb,cjcjameson/gpdb,royc1/gpdb,yuanzhao/gpdb,0x0FFF/gpdb,rvs/gpdb,cjcjameson/gpdb,CraigHarris/gpdb,cjcjameson/gpdb,janebeckman/gpdb,Quikling/gpdb,edespino/gpdb,yuanzhao/gpdb,lintzc/gpdb,yuanzhao/gpdb,lintzc/gpdb,Chibin/gpdb,Quikling/gpdb,kaknikhil/gpdb,Quikling/gpdb,greenplum-db/gpdb,royc1/gpdb,janebeckman/gpdb,zaksoup/gpdb,Chibin/gpdb,edespino/gpdb,lintzc/gpdb,CraigHarris/gpdb,yuanzhao/gpdb,Quikling/gpdb,zaksoup/gpdb,rvs/gpdb,rvs/gpdb,lintzc/gpdb,kaknikhil/gpdb,chrishajas/gpdb,xuegang/gpdb,jmcatamney/gpdb,xuegang/gpdb,jmcatamney/gpdb,CraigHarris/gpdb,50wu/gpdb,0x0FFF/gpdb,yuanzhao/gpdb,cjcjameson/gpdb,chrishajas/gpdb,kaknikhil/gpdb,50wu/gpdb