postgresql postgres 相当于 oracle sqlplus“设置回显”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5099605/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
postgres equivilent of oracle sqlplus "set echo on"
提问by Philip Schlump
Is there an equivalent in PostgreSQL of the Oracle SQLPLUS "set echo on" so that I can get batch input statements echoed in the output?
在 PostgreSQL 中是否有与 Oracle SQLPLUS“set echo on”等效的内容,以便我可以在输出中回显批处理输入语句?
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.
我有一个非常大的文件,其中包含输入语句,运行时出现一些错误。我很难找到产生错误的语句,因为 psql 只报告错误 - 而不是产生错误的语句。
回答by Brian L
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.htmlunder OPTIONS.
您需要将-a
(或--echo-all
) 参数传递给psql
. 它在https://www.postgresql.org/docs/current/static/app-psql.html 的OPTIONS 下有描述。
回答by araqnid
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.
PostgreSQL 还在其服务器日志中记录错误,以及导致错误的语句。记住这对于使用 psql 以外的工具调试错误可能很有用,这些工具不能很好地报告错误。