Re: Perl and AutoCommit - Mailing list pgsql-general

From Ragnar Hafstað
Subject Re: Perl and AutoCommit
Date
Msg-id 1111919776.1995.32.camel@localhost.localdomain
Whole thread Raw
In response to Perl and AutoCommit  (Madison Kelly <linux@alteeve.com>)
List pgsql-general
On Sun, 2005-03-27 at 00:31 -0500, Madison Kelly wrote:

>    What I thought would work was:
>
> $DB->begin_work() || die...
> # a lot of transactions
> $DB->commit() || die...
>

maybe a more complete testcase would be in order.

gnari@gnari:~/test $ cat trans.pl
use DBI;
our $dbh = DBI->connect('dbi:Pg:dbname=test') or die 'no database';
$dbh->do('create table transtest(a text)');
$dbh->begin_work() or die 'error in begin';
$dbh->do("insert into transtest values ('foo')");
$dbh->do("insert into transtest values ('bar')");
$dbh->commit() or die 'error in commit' ;
system("psql -d test -c 'select * from transtest;'")

gnari@gnari:~/test $ perl trans.pl
  a
-----
 foo
 bar
(2 rows)

gnari@gnari:~/test $


gnari@gnari:~/test $ perl -v

This is perl, v5.8.4 built for x86_64-linux-thread-multi

gnari@gnari:~/test $ perl -MDBI -le 'print $DBI::VERSION'
1.42
gnari@gnari:~/test $


perhaps a database operation is failing between your begin_work()
and your commit() ?

gnari



pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Debugging deadlocks
Next
From: Jaqui Greenlees
Date:
Subject: major delays in list....