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

From Michael Paesold
Subject Re: [PATCHES] Continue transactions after errors in psql
Date
Msg-id 004d01c54a5a$8e38db10$6f01a8c0@zaphod
Whole thread Raw
In response to Re: [PATCHES] Continue transactions after errors in psql  ("Greg Sabino Mullane" <greg@turnstep.com>)
Responses Re: [PATCHES] Continue transactions after errors in psql  (Richard Huxton <dev@archonet.com>)
List pgsql-hackers
Greg Sabino Mullane wrote:
> To reiterate my opinion, I think the behavior should be the same
> for interactive and non-interactive sessions. Not only will it
> prevent nasty surprises, but unless we make a third 'setting',
> there will be no way to enable this in non-interactive scripts,
> which is something that I would want to be able to do.
>
>  > I don't buy the "but what if I set it in .psqlrc and forget" argument.
> That could be applied to a lot of things you could put in there. This
> setting defaults to "off" and must be explicitly enabled. I'd be okay
> with a "smart" mode that explicitly enables the
> interactive/non-interactive
> split.

But people (like me for example) will want to enable this behaviour by
default. So they (me too) will put the option in .psqlrc. It is then enabled
"by default". But then many of my scripts will destroy data instead of just
erroring out.
I just don't see why non-interactive mode does need such a switch because
there is no way to check if there was an error. So just put two queries
there and hope one will work?

If you really want this for scripts, there must be two options:
* one to put savely into .psqlrc (what some people will want, I have \set
AUTOCOMMIT off in my .psqlrc file, too, and I know I am not the only one)
* another one that will also work in scripts

I hope you understand and accept the issue here.

Best Regards,
Michael Paesold


pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: bitmapscan test, no success, again
Next
From: Richard Huxton
Date:
Subject: Re: [PATCHES] Continue transactions after errors in psql