Thread

  1. Re: thread-safe libpq and DBD::Pg

    Goran Thyni <goran@bildbasen.se> — 1998-08-09T08:16:36Z

    Tom Lane wrote:
    > 
    > Goran Thyni <goran@bildbasen.se> writes:
    > > Has anyone any experience of the thread-safeness of libpq?
    > 
    > PQconnectdb() is not thread-safe, because it scribbles temporary
    > data in the static PQconninfoOptions array.  You can get around
    > that easily enough by not using PQconnectdb (or PQconndefaults)
    > --- use PQsetdbLogin() instead.  In any case the problem exists
    > only if different threads try to open database connections
    > at the same time.
    > [...}
    
    Tom,
    thanks for the reply.
    DBD::Pg dos indeed use PQconnectdb(),
    but at least in my light test I get SEGV in $sth->fetch.
    The problems are probably somewhere in DBDI or DBD::Pg or
    somewhere in the interaction of the parts.
    
    I am looking into how much work a "pure Perl" interface
    should amount to. Using native perl IO and pgsql-fe/be-protocol
    should make "pgsql-clienting" even more portable over platforms.
    
    	regards,
    		Göran