On Tue, Sep 27, 2011 at 7:57 PM, Will Leinweber <w...@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