Re: [HACKERS] Continue transactions after errors in psql
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bruce Momjian <pgman@candle.pha.pa.us>
Cc: Andrew Dunstan <andrew@dunslane.net>, Richard Huxton <dev@archonet.com>, Michael Paesold <mpaesold@gmx.at>, Greg Sabino Mullane <greg@turnstep.com>, pgsql-hackers@postgresql.org, pgsql-patches@postgresql.org
Date: 2005-04-27T17:16:40Z
Lists: pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.us> writes: > Tom Lane wrote: >> Well, that's just a matter of choosing good (ie short) names for the >> backslash commands. I was trying to be clear rather than proposing >> names I would actually want to use ;-). Any suggestions? > Well, if we allowed ON_ERROR_ROLLBACK to work in non-interactive > sessions we could just do: > \set ON_ERROR_ROLLBACK on > DROP TABLE foo; > \set ON_ERROR_ROLLBACK off That isn't the same thing at all. The syntax I was proposing allows the script writer to define a savepoint covering multiple statements, whereas the above does not. Maybe what we really need is a "rollback or release savepoint" operation, defined as "ROLLBACK TO foo if in error state, RELEASE foo if not in error state". This is essentially the thing that a script writer has to have and can't do for himself due to the lack of any conditional ability in psql scripts. We could imagine implementing that either as a SQL command or as a psql backslash command ... I don't have a strong feeling either way. regards, tom lane