小编Emi*_*zer的帖子

如何使用 psql --single-transaction 仅获取第一个错误

我正在输入类似的内容:

psql --single-transaction --quiet my_db < my_file.sql
Run Code Online (Sandbox Code Playgroud)

当脚本失败时,我收到很多行说:current transaction is aborted, commands ignored until end of transaction block.

在 linux 中我可以使用| more管道传输结果,但在 Windows 中这可能需要很多时间(显示第一个错误,因为管道不是管道)。

我的问题:

有没有办法只得到第一个错误?

  • .sql 文件由我生成,如果需要,我可以添加一些集合或命令
  • Y 尝试 --file (我获得相同的行为)

postgresql psql errors

4
推荐指数
1
解决办法
1161
查看次数

标签 统计

errors ×1

postgresql ×1

psql ×1