http://www.perlmonks.org?node_id=1160340

angeloulivieri has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,

I have searched a lot but couldn't find an answer to this. I am using the construct

$dbh = DBI->connect($dsn, $user, $pass, { RaiseError => 1, AutoCommit +=> 0 }); #Here we open a locked access to the database my $select_handle; eval{ $dbh->do("BEGIN WORK"); $dbh->do("LOCK TABLE $table"); ###CODE $dbh->do("COMMIT WORK"); };

To access a Postgres db in a exclusive way. This construct works fine but each time it is used a Warning comes out

WARNING: there is already a transaction in progress

Someone knows how can I avoid it? It is little annoying this print in the log file of my program which accesses tens of times to the database. Thanks in advance