The pg_atoi() function uses strtol() to convert the string to numbers.  Some implementations of strtol() treat empty strings ("") as invalid arguments while others convert this (erroneously, IHMO) to zero (0).  Assuming that the expected behaviour of pg_atoi() is to return 0 if it is passed an empty string, I am supplying the following patch to explictly check for an empty string in pg_atoi() and return 0 if the string is empty.  The patch will also trap a NULL character pointer being passed to pg_atoi() and will use elog() to print out an error message if the input char pointer is NULL.
The pg_atoi() function uses strtol() to convert the string to numbers.  Some
implementations of strtol() treat empty strings ("") as invalid arguments
while others convert this (erroneously, IHMO) to zero (0).  Assuming that the
expected behaviour of pg_atoi() is to return 0 if it is passed an empty
string, I am supplying the following patch to explictly check for an empty
string in pg_atoi() and return 0 if the string is empty.  The patch will also
trap a NULL character pointer being passed to pg_atoi() and will use elog() to
print out an error message if the input char pointer is NULL.


Billy G. Allie

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