Frank van Vugt <ftm(dot)van(dot)vugt(at)foxi(dot)nl> writes:
> // PostgreSQL header <catalog/pg_type.h> redefines errno erroneously.
> #if defined(errno)
> # undef errno
> #endif
> #define errno qt_psql_errno
> #include <catalog/pg_type.h>
> #undef errno
It seems highly unlikely that the above is a good idea. errno is a
macro on all threaded platforms I'm aware of, but the above coding
forgets the definition. The behavior complained of in the comment
is gone anyway in PG 7.3.
Not sure that this explains your problem though.
There are several places in libpq that invoke libc routines that are
not thread-safe (on most platforms anyway). We have attempted to
rectify this for PG 7.4. You may care to try your test with CVS tip and
see if it works better.
regards, tom lane