Run COPY OUT in a temporary memory context that's reset once per row, and eliminate its manual pfree() calls.  This solves the encoding-conversion bug recently reported, and should be faster and more robust than the original coding anyway.  For example, we are no longer at risk if datatype output routines leak memory or choose to return a constant string.
Run COPY OUT in a temporary memory context that's reset once per row,
and eliminate its manual pfree() calls.  This solves the encoding-conversion
bug recently reported, and should be faster and more robust than the
original coding anyway.  For example, we are no longer at risk if
datatype output routines leak memory or choose to return a constant string.

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