X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id BF19FD1C9DB for ; Mon, 4 Aug 2003 15:47:48 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 23277-10 for ; Mon, 4 Aug 2003 12:46:32 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id D503ED1C92D for ; Mon, 4 Aug 2003 12:47:37 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h74FlZSa002779; Mon, 4 Aug 2003 11:47:36 -0400 (EDT) To: Frank van Vugt Cc: pgsql-interfaces@postgresql.org Subject: Re: Multi-threaded user app segfaults when using libpq with separate connections In-reply-to: <200308041729.13212.ftm.van.vugt@foxi.nl> References: <200308041729.13212.ftm.van.vugt@foxi.nl> Comments: In-reply-to Frank van Vugt message dated "Mon, 04 Aug 2003 17:29:13 +0200" Date: Mon, 04 Aug 2003 11:47:35 -0400 Message-ID: <2778.1060012055@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/9 X-Sequence-Number: 4363 Frank van Vugt writes: > // PostgreSQL header redefines errno erroneously. > #if defined(errno) > # undef errno > #endif > #define errno qt_psql_errno > #include > #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