Re: Continue transactions after errors in psql

Michael Paesold <mpaesold@gmx.at>

From: "Michael Paesold" <mpaesold@gmx.at>
To: "Greg Sabino Mullane" <greg@turnstep.com>, <pgsql-patches@postgresql.org>
Date: 2005-03-07T08:51:49Z
Lists: pgsql-hackers
Greg Sabino Mullane wrote:

> Finally had a chance to sit down at look at this afresh, and I'm
> pretty sure I've got all the kinks worked out this time. Apologies
> for not attaching, but my mail system is not working well enough
> at the moment. So, please try to break this patch:
>
> http://www.gtsm.com/pg/psql_error_recovery.diff


Some suggestions in random order:

* I think you should use PSQLexec instead of using PQexec directly. PSQLexec 
is used by all \-commands and prints out queries with -E, which is very 
helpful for debugging.

  -E         display queries that internal commands generate

* You do not check for the server version before activating \reseterror.
  -> use PQserverVersion() to check for >= 80000

* Perhaps the name should be \reseterrors (plural)? Just my personal opinion 
though.

* If I read the code correctly, you now don't destroy user savepoints 
anymore, but on the other hand, you do not release the psql savepoint after 
a user-defined savepoint is released. In other words, each time a user 
creates a savepoint, one psql savepoint is left on the subxact stack. I 
don't know if this is a real problem, though.

* You have not yet implemented a way to savely put \reseterror in .psqlrc. I 
previously suggested an AUTO setting (additional to ON/OFF) that disables 
\reseterror when reading from a non-tty. So putting \reseterror AUTO in 
.psqlrc would be save.

Otherwise, I could not find a way to break it. :-)

Best Regards,
Michael Paesold