Re: Multi-threaded user app segfaults when using libpq with separate connections

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Frank van Vugt <ftm(dot)van(dot)vugt(at)foxi(dot)nl>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: Multi-threaded user app segfaults when using libpq with separate connections
Date: 2003-08-04 15:47:35
Message-ID: 2778.1060012055@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

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

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Daniel Brozek 2003-08-04 17:28:42 unicode and libpq
Previous Message Frank van Vugt 2003-08-04 15:29:13 Multi-threaded user app segfaults when using libpq with separate connections