Thread: Shouldn't psql -1 imply ON_ERROR_STOP?
When you run a file with psql -1/--single-transaction, and a command fails, you get bombarded with ERROR: current transaction is aborted, commands ignored until end of transaction block for the rest of the file. Shouldn't -1 imply ON_ERROR_STOP or some variant by default?
On Saturday, July 25, 2009, Peter Eisentraut <peter_e@gmx.net> wrote: > When you run a file with psql -1/--single-transaction, and a command fails, > you get bombarded with > > ERROR: current transaction is aborted, commands ignored until end of > transaction block > > for the rest of the file. > That would certainly be useful. Personally I'd prefer it to default to that always, and not just in -1, but that would break way too many old things I'm afraid... /Magnus > Shouldn't -1 imply ON_ERROR_STOP or some variant by default? > > -- > Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-hackers > -- Magnus HaganderSelf: http://www.hagander.net/Work: http://www.redpill-linpro.com/
On Sat, Jul 25, 2009 at 9:06 AM, Magnus Hagander<magnus@hagander.net> wrote: > On Saturday, July 25, 2009, Peter Eisentraut <peter_e@gmx.net> wrote: >> When you run a file with psql -1/--single-transaction, and a command fails, >> you get bombarded with >> >> ERROR: current transaction is aborted, commands ignored until end of >> transaction block >> >> for the rest of the file. >> > > That would certainly be useful. > > Personally I'd prefer it to default to that always, and not just in > -1, but that would break way too many old things I'm afraid... Doing it always would be really annoying. I often reload dumps that fail the grant statements but otherwise work. Admittedly, if I planned ahead, I could avoid having the grants be present in the dumps, but that would require planning ahead... But +1 for doing it when -1 is used. ...Robert
Am 25.07.2009 um 15:00 schrieb Peter Eisentraut: > When you run a file with psql -1/--single-transaction, and a command > fails, > you get bombarded with > > ERROR: current transaction is aborted, commands ignored until end of > transaction block > > for the rest of the file. > > Shouldn't -1 imply ON_ERROR_STOP or some variant by default? Sounds reasonable, +1 from me. Regards Michael Paesold
--On Samstag, Juli 25, 2009 16:00:18 +0300 Peter Eisentraut <peter_e@gmx.net> wrote: > When you run a file with psql -1/--single-transaction, and a command > fails, you get bombarded with > > ERROR: current transaction is aborted, commands ignored until end of > transaction block > > for the rest of the file. > > Shouldn't -1 imply ON_ERROR_STOP or some variant by default? Only if it could ensured that embedded SAVEPOINTS can be handled properly...a quick check shows that ON_ERROR_STOP will stop any script even when the errorneous command is probably rolled back by a subsequent ROLLBACK TO: SELECT 1; SAVEPOINT A; SELECT et; <-- ON_ERROR_STOP stops here ROLLBACK TO A; SELECT 2; It seems -1 needs some smarter variant of ON_ERROR_STOP. -- Thanks Bernd