Re: feature request: auto savepoint for interactive psql when in transaction.

From: Gurjeet Singh <singh(dot)gurjeet(at)gmail(dot)com>
To: Will Leinweber <will(at)heroku(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: feature request: auto savepoint for interactive psql when in transaction.
Date: 2011-09-28 17:30:22
Message-ID: CABwTF4V_J47GaryQcHD5Xe9gR57=shiYaKgRTjBCUsFQFvpByA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 27, 2011 at 7:57 PM, Will Leinweber <will(at)heroku(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marko Tiikkaja 2011-09-28 17:39:59 Re: feature request: auto savepoint for interactive psql when in transaction.
Previous Message Bruce Momjian 2011-09-28 16:48:28 Re: fix for pg_upgrade