3

I'm typing something like:

psql --single-transaction --quiet my_db < my_file.sql

When the script fails I get many lines saying: current transaction is aborted, commands ignored until end of transaction block.

In linux I can use | more to pipe the result, but in Windows thats may take a lot of time (to show the first error, because the pipe is not a pipe).

My question:

Is there a way to get only the first error?

  • The .sql file is generated by me, I can add some sets or commands if necesary
  • Y try --file (I obtain the same behavior)
7

You may just ask it to stop on the first error:

$ psql -v ON_ERROR_STOP=on --single-transaction ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.