使用“\x”时,在一行中运行多个命令会失败使用 PSQL (POSTGRES)
我正在尝试在一行中运行以下查询:
\x
select * from pg_stat_statements order by max_exec_time desc limit 10;
如下所示:
kubectl -n MYNAMESPACEXXX exec -ti MYPGPOD-K8SXXX -- psql -d MY-DB -U postgres -c '\x select * from pg_stat_statements order by max_exec_time desc limit 10;'
但我得到了
unrecognized value "select" for "expanded"
Available values are: on, off, auto.
command terminated with exit code 1
How can we join those \x
和 SQL 查询?
I'm trying to run the following queries in one line:
\x
select * from pg_stat_statements order by max_exec_time desc limit 10;
As follows:
kubectl -n MYNAMESPACEXXX exec -ti MYPGPOD-K8SXXX -- psql -d MY-DB -U postgres -c '\x select * from pg_stat_statements order by max_exec_time desc limit 10;'
But I get
unrecognized value "select" for "expanded"
Available values are: on, off, auto.
command terminated with exit code 1
How can we combine both \x
and the SQL query ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
另一种方法是多次使用
-c
选项:An alternative is to use the
-c
option several times:您还可以从命令行设置
扩展
模式:You can also set the
expanded
mode from the commandline: