Re: feature request: auto savepoint for interactive psql when in transaction. - Mailing list pgsql-hackers

From Gurjeet Singh
Subject Re: feature request: auto savepoint for interactive psql when in transaction.
Date
Msg-id CABwTF4V_J47GaryQcHD5Xe9gR57=shiYaKgRTjBCUsFQFvpByA@mail.gmail.com
Whole thread
In response to feature request: auto savepoint for interactive psql when in transaction.  (Will Leinweber <will@heroku.com>)
Responses Re: feature request: auto savepoint for interactive psql when in transaction.
List pgsql-hackers
On Tue, Sep 27, 2011 at 7:57 PM, Will Leinweber <will@heroku.com> wrote:
I ruined a 5 hour UPDATE by typoing a table name on a SELECT to verify
the update worked. I suppose I have no one else to blame, but it was
really frustrating, to say the least. I assume this has happened to
others as well.

I only later found out about SAVEPOINT, which I immediately ran the
next time I attempted the huge update.

psql console, while in a transaction, and while in interactive mode,
should savepoint for me.


I guess it would be a neat feature to have this in Postgres rather than in psql. That is, if running in an explicit transaction (one started with BEGIN), issue a savepoint after/before every command and emit the savepoint name in a NOTICE.

I *think* savepoints are detrimental to performance, maybe under certain pre-conditions, so it might be desirable to control it using a user-settable parameter.

If there's no perceivable performance difference in using savepoints even under large transactions, then we might want to make it all automatic and transparent. So Postgres issues a savepoint before every command, and if the command fails, rollback to that savepoint, else release that savepoint.

Regards,
--
Gurjeet Singh
EnterpriseDB Corporation
The Enterprise PostgreSQL Company

pgsql-hackers by date:

Previous
From: Will Leinweber
Date:
Subject: feature request: auto savepoint for interactive psql when in transaction.
Next
From: Marko Tiikkaja
Date:
Subject: Re: feature request: auto savepoint for interactive psql when in transaction.