Add a stack overflow check to copyObject().
Add a stack overflow check to copyObject().

There are some code paths, such as SPI_execute(), where we invoke
copyObject() on raw parse trees before doing parse analysis on them.  Since
the bison grammar is capable of building heavily nested parsetrees while
itself using only minimal stack depth, this means that copyObject() can be
the front-line function that hits stack overflow before anything else does.
Accordingly, it had better have a check_stack_depth() call.  I did a bit of
performance testing and found that this slows down copyObject() by only a
few percent, so the hit ought to be negligible in the context of complete
processing of a query.

Per off-list report from Toshihide Katayama.  Back-patch to all supported
branches.

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