还原sql时psql无效命令\N [英] psql invalid command \N while restore sql
问题描述
我正在尝试恢复转储文件,但它导致错误:
I'm trying to restore my dump file, but it caused an error:
psql:psit.sql:27485: invalid command \N
有解决方案吗?我进行了搜索,但没有得到明确的答案。
Is there a solution? I searched, but I didn't get a clear answer.
推荐答案
Postgres使用 \N作为NULL的替代符号值。但是所有psql命令都以反斜杠 \符号开头。因此,当copy语句可能失败但转储继续加载时,您可以获得此消息。此消息仅是错误警报。您必须先搜索一行以获取COPY语句失败的原因。
Postgres uses "\N" as substitute symbol for NULL value. But all psql commands starts by backslash "\" symbol. So you can get this messages, when probably copy statement fails, but a loading of dump continues. This message is only false alarm. You have to search a lines before for reason why COPY statement fails.
可以将psql切换为在第一个错误时停止模式并查找错误:
Is possible to switch psql to "stop on first error" mode and to find error:
psql -v ON_ERROR_STOP=1
这篇关于还原sql时psql无效命令\N的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!