Is anyone using PostgreSQL via DBD::Pg in a threaded environment?
It appears as though the DBD::Pg driver hasn't been made thread-safe yet.
However it's possible that I'm misusing it somehow, doing something in my
startup.pl that I shouldn't, whatever. So I'm asking if anyone else is
using DBD::Pg successfully w/mp2 at the current time???
From the DBD::Pg mailing list:
-
The version in CVS should work with threading, but the version on CPAN
does not yet. You can download a cvs copy:
http://gborg.postgresql.org/project/dbdpg/projdisplay.php
or just add these three lines to Pg.pm and recompile:
diff -c -r1.37 Pg.pm
*** Pg.pm 10 Jun 2003 19:14:53 -
1.37
--- Pg.pm 22 Jun 2003 21:22:31 -
***
*** 38,43
--- 38,47
$errstr = ; # holds error string for DBI::errstr
$drh = undef; # holds driver handle once initialized
+ sub CLONE {
+ $drh = undef ;
+ }
+
sub driver{
return $drh if $drh;
my($class, $attr) = @_;
-
I've tried it and it seems to work just fine.
mma