postgres equivilent of oracle sqlplus "set echo on"
Is there an equivalent in PostgreSQL of the Oracle SQLPLUS "set ec开发者_开发问答ho on" so that I can get batch input statements echoed in the output?
I have a very large file with input statements in it that has a few errors when I run it. I am having difficulty finding the statement that produced the error because psql is only reporting the error - not the statement that generated the error.
You need to pass the -a
(or --echo-all
) argument to psql
. It's described at https://www.postgresql.org/docs/current/static/app-psql.html under OPTIONS.
PostgreSQL also logs errors in its server logs, along with the statement that caused it. That might be useful to bear in mind for debugging errors with tools other than psql that don't report errors very well.
精彩评论