A test to verify psycopg issue #263. Compile with:
$ gcc -I$(pg_config --includedir) -c testclose.c
$ gcc -o testclose testclose.o -L$(pg_config --libdir) -lpq
The output (with PostgreSQL 9.3.5) suggests PQstatus
is not good to detect the closed fd.
$ ./testclose
PQconsumeInput is fine
file closed
PQconsumeInput error: could not receive data from server: Bad file descriptor
PQstatus 0 CONNECTION_OK: 0
PQxnstatus 0 IDLE: 0