Bruce Momjian <> 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

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Reply via email to