Try to defend against the possibility that libpq is still in COPY_IN state when we reach the post-COPY "pump it dry" error recovery code that was added 2006-11-24.  Per a report from Neil Best, there is at least one code path in which this occurs, leading to an infinite loop in code that's supposed to be making it more robust not less so.  A reasonable response seems to be to call PQputCopyEnd() again, so let's try that.
Try to defend against the possibility that libpq is still in COPY_IN state
when we reach the post-COPY "pump it dry" error recovery code that was added
2006-11-24.  Per a report from Neil Best, there is at least one code path
in which this occurs, leading to an infinite loop in code that's supposed
to be making it more robust not less so.  A reasonable response seems to be
to call PQputCopyEnd() again, so let's try that.

Back-patch to all versions that contain the cleanup loop.

jmcatamney/gpdb,kmjungersen/PostgresXL,xinzweb/gpdb,ashwinstar/gpdb,ashwinstar/gpdb,arcivanov/postgres-xl,snaga/postgres-xl,Postgres-XL/Postgres-XL,adam8157/gpdb,adam8157/gpdb,tpostgres-projects/tPostgres,ovr/postgres-xl,greenplum-db/gpdb,greenplum-db/gpdb,ovr/postgres-xl,zeroae/postgres-xl,ovr/postgres-xl,postmind-net/postgres-xl,yazun/postgres-xl,snaga/postgres-xl,lisakowen/gpdb,tpostgres-projects/tPostgres,jmcatamney/gpdb,jmcatamney/gpdb,yazun/postgres-xl,adam8157/gpdb,lisakowen/gpdb,xinzweb/gpdb,50wu/gpdb,oberstet/postgres-xl,50wu/gpdb,jmcatamney/gpdb,ashwinstar/gpdb,adam8157/gpdb,adam8157/gpdb,yazun/postgres-xl,ashwinstar/gpdb,zeroae/postgres-xl,yazun/postgres-xl,jmcatamney/gpdb,jmcatamney/gpdb,ashwinstar/gpdb,lisakowen/gpdb,xinzweb/gpdb,50wu/gpdb,pavanvd/postgres-xl,tpostgres-projects/tPostgres,kmjungersen/PostgresXL,arcivanov/postgres-xl,postmind-net/postgres-xl,50wu/gpdb,snaga/postgres-xl,ashwinstar/gpdb,tpostgres-projects/tPostgres,Postgres-XL/Postgres-XL,adam8157/gpdb,zeroae/postgres-xl,adam8157/gpdb,adam8157/gpdb,tpostgres-projects/tPostgres,arcivanov/postgres-xl,Postgres-XL/Postgres-XL,lisakowen/gpdb,ovr/postgres-xl,Postgres-XL/Postgres-XL,kmjungersen/PostgresXL,greenplum-db/gpdb,greenplum-db/gpdb,zeroae/postgres-xl,50wu/gpdb,ashwinstar/gpdb,arcivanov/postgres-xl,techdragon/Postgres-XL,Postgres-XL/Postgres-XL,oberstet/postgres-xl,yazun/postgres-xl,pavanvd/postgres-xl,jmcatamney/gpdb,pavanvd/postgres-xl,techdragon/Postgres-XL,pavanvd/postgres-xl,xinzweb/gpdb,lisakowen/gpdb,greenplum-db/gpdb,greenplum-db/gpdb,snaga/postgres-xl,lisakowen/gpdb,postmind-net/postgres-xl,zeroae/postgres-xl,snaga/postgres-xl,jmcatamney/gpdb,ovr/postgres-xl,postmind-net/postgres-xl,kmjungersen/PostgresXL,techdragon/Postgres-XL,xinzweb/gpdb,50wu/gpdb,greenplum-db/gpdb,xinzweb/gpdb,xinzweb/gpdb,50wu/gpdb,oberstet/postgres-xl,oberstet/postgres-xl,xinzweb/gpdb,50wu/gpdb,pavanvd/postgres-xl,arcivanov/postgres-xl,ashwinstar/gpdb,arcivanov/postgres-xl,techdragon/Postgres-XL,kmjungersen/PostgresXL,lisakowen/gpdb,lisakowen/gpdb,oberstet/postgres-xl,techdragon/Postgres-XL,postmind-net/postgres-xl,greenplum-db/gpdb