Re: Multi-threaded user app segfaults when using libpq with separate connections - Mailing list pgsql-interfaces

From Tom Lane
Subject Re: Multi-threaded user app segfaults when using libpq with separate connections
Date
Msg-id 2778.1060012055@sss.pgh.pa.us
Whole thread Raw
In response to Multi-threaded user app segfaults when using libpq with separate connections  (Frank van Vugt <ftm.van.vugt@foxi.nl>)
Responses Re: Multi-threaded user app segfaults when using libpq with separate connections  (Frank van Vugt <ftm.van.vugt@foxi.nl>)
List pgsql-interfaces
Frank van Vugt <ftm.van.vugt@foxi.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


pgsql-interfaces by date:

Previous
From: Frank van Vugt
Date:
Subject: Multi-threaded user app segfaults when using libpq with separate connections
Next
From: Daniel Brozek
Date:
Subject: unicode and libpq