Re: [PATCHES] Continue transactions after errors in psql - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCHES] Continue transactions after errors in psql
Date
Msg-id 24113.1114622200@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PATCHES] Continue transactions after errors in psql  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: [PATCHES] Continue transactions after errors in psql  (Bruce Momjian <pgman@candle.pha.pa.us>)
List 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

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [PATCHES] Continue transactions after errors in psql
Next
From: Greg Stark
Date:
Subject: Re: [PERFORM] Bad n_distinct estimation; hacks suggested?