Fix plpgsql's exec_move_row() to supply valid type OIDs to exec_assign_value() whenever possible, as per bug report from Oleg Serov.  While at it, reorder the operations in the RECORD case to avoid possible palloc failure while the variable update is only partly complete.
Fix plpgsql's exec_move_row() to supply valid type OIDs to exec_assign_value()
whenever possible, as per bug report from Oleg Serov.  While at it, reorder
the operations in the RECORD case to avoid possible palloc failure while the
variable update is only partly complete.

Back-patch as far as 8.1.  Although the code of the particular function is
similar in 8.0, 8.0's support for composite fields in rows is sufficiently
broken elsewhere that it doesn't seem worth fixing this.

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