[rt.cpan.org #18387] Apparent transaction state corruption leads to silent failures
"Jon Jensen via RT" <[email protected]>
| Newsgroups | gmane.comp.db.postgresql.dbdpg |
|---|---|
| Message-ID | <[email protected]> |
Queue: DBD-Pg
Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=18387 >
On Tue Mar 28 09:32:42 2006, JSIRACUSA wrote:
> I also think you're misreading the meaning of AutoCommit with respect to
> begin_work(). From the DBI docs:
>
> http://search.cpan.org/dist/DBI/DBI.pm#begin_work
>
> > $rc = $dbh->begin_work or die $dbh->errstr;
> >
> > Enable transactions (by turning AutoCommit off) until the next call
> > to commit or rollback. After the next commit or rollback, AutoCommit
> > will automatically be turned on again.
> >
> > If AutoCommit is already off when begin_work is called then it does
> > nothing except return an error. If the driver does not support
> > transactions then when begin_work attempts to set AutoCommit off the
> > driver will trigger a fatal error.
>
> The whole point of begin_work() is that it begins a transaction when
> AutoCommit is on. In light of this, look again at the example and it
> should become clear that it demonstrates obviously incorrect behavior.
Huh. Yeah, the DBI docs make more sense there. But maybe I was
misunderstanding the DBD::Pg docs on the subject. They mention "BEGIN"
et al. (SQL statements), and not the begin_work method, which are two
different things.
If AutoCommit is on, and one does a begin_work, some other statements,
and a commit or rollback, is everything after that point auto-committed
again until the next begin_work call?