PostgreSQL - 如何抑制查询语句消息
PostgreSQL - How to suppress query statement message
我使用一个包含所有 SQL 查询的文件。我运行以下命令:
psql -U postgres -d rails_development -a -f ProjectApp/db/Query.sql
输出如下:
SELECT * FROM "Users"
id | username | firstname | lastname | [...]
...
(27 rows)
我想从输出中删除查询消息 (SELECT * FROM "Users")。这可能吗?
-a
或 --echo-all
回显来自脚本的所有输入。你不需要那个。包括 --tuples-only
或 -t
标志以仅像这样打印行:
psql -U postgres -d rails_development --tuples-only -f ProjectApp/db/Query.sql
psql --help
说:
...
Input and output options:
-a, --echo-all echo all input from script
-e, --echo-queries echo commands sent to server
...
Output format options:
...
-R, --record-separator=STRING
set record separator (default: newline)
-t, --tuples-only print rows only
...
-a 选项重复终端 (STDOUT) 上的每个查询,您想从命令行中删除此选项。
我使用一个包含所有 SQL 查询的文件。我运行以下命令:
psql -U postgres -d rails_development -a -f ProjectApp/db/Query.sql
输出如下:
SELECT * FROM "Users"
id | username | firstname | lastname | [...]
...
(27 rows)
我想从输出中删除查询消息 (SELECT * FROM "Users")。这可能吗?
-a
或 --echo-all
回显来自脚本的所有输入。你不需要那个。包括 --tuples-only
或 -t
标志以仅像这样打印行:
psql -U postgres -d rails_development --tuples-only -f ProjectApp/db/Query.sql
psql --help
说:
...
Input and output options:
-a, --echo-all echo all input from script
-e, --echo-queries echo commands sent to server
...
Output format options:
...
-R, --record-separator=STRING
set record separator (default: newline)
-t, --tuples-only print rows only
...
-a 选项重复终端 (STDOUT) 上的每个查询,您想从命令行中删除此选项。