Re: [HACKERS] Continue transactions after errors in psql

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Richard Huxton <dev(at)archonet(dot)com>, Michael Paesold <mpaesold(at)gmx(dot)at>, Greg Sabino Mullane <greg(at)turnstep(dot)com>, pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] Continue transactions after errors in psql
Date: 2005-04-27 17:16:40
Message-ID: 24113.1114622200@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2005-04-27 17:16:48 Re: [HACKERS] Bad n_distinct estimation; hacks suggested?
Previous Message Bruce Momjian 2005-04-27 16:39:44 Re: [HACKERS] Continue transactions after errors in psql

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2005-04-27 17:20:29 Re: Cleaning up unreferenced table files
Previous Message Bruce Momjian 2005-04-27 17:13:11 Re: Cleaning up unreferenced table files