DBI, savepoints, transactions, and AutoCommit

From: felix(at)crowfix(dot)com
To: pgsql-novice(at)postgresql(dot)org
Subject: DBI, savepoints, transactions, and AutoCommit
Date: 2011-11-02 20:14:40
Message-ID: 20111102201440.GF5551@crowfix.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I understand the concepts of savepoints, and I have played with them
in psql enough to understand that yes, as the fine manual says, they
must be inside a transaction to work. But how does this relate to DBI
and DBD::Pg with AutoCommit off? I learned the slow way that if
AutoCommit is disabled, you don't issue a BEGIN WORK because that
looks like trying to start a transaction inside a transaction. But I
I have AutoCommit off and try SAVEPOINT xyzzy, it tells me savepoints
must be inside a transaction. And of course, I can't get inside a
transaction because I can't issue a BEGIN WORK because I am already
inside a transaction.

Is this a case of what's sauce for the goose not being sauce for the
gander?

How do I use savepoints in DBI/DBD::Pg without enabling AutoCommit?
Do I turn AutoCommit on, BEGIN WORK, SAVEPOINT xyzzy, and disable
AutoCommit again? That sure doesn't sound reasonable.

(I also have tis problem with SQLite, so I suspect it's a brain
failure on my part rather than the rest of the world conspiring to
confuse me, which isn't even very hard to do.)

--
... _._. ._ ._. . _._. ._. ___ .__ ._. . .__. ._ .. ._.
Felix Finch: scarecrow repairman & rocket surgeon / felix(at)crowfix(dot)com
GPG = E987 4493 C860 246C 3B1E 6477 7838 76E9 182E 8151 ITAR license #4933
I've found a solution to Fermat's Last Theorem but I see I've run out of room o

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Daniel Staal 2011-11-02 22:05:56 Re: DBI, savepoints, transactions, and AutoCommit
Previous Message Jean-Yves F. Barbier 2011-11-02 19:07:29 Re: WARNING: pgstat wait timeout