无法使用pg_restore为Postgres恢复转储备份文件

Eki*_*bal 7 postgresql psql

我使用这个为Postgres 9.3.4生成了一个转储备份文件:

pg_dump table_name -U myusername -h localhost -O > backup.dump
Run Code Online (Sandbox Code Playgroud)

现在我正在尝试使用以下方法备份旧数据库:

pg_restore -U myusername -n public -d table_name  backup.dump
Run Code Online (Sandbox Code Playgroud)

但我一直收到这个错误:

pg_restore: [archiver] input file appears to be a text format dump. Please use psql.
Run Code Online (Sandbox Code Playgroud)

请注意,该文件不是普通的sql文件,因为我使用pg_dump生成它.

我使用了以下命令:

psql perchwell -U myusername -f backup.dump -v ON_ERROR_STOP=1
Run Code Online (Sandbox Code Playgroud)

并开始收到以下错误:

SET
SET
SET
SET
SET
SET
psql:backup.dump:16: ERROR:  schema "propertydir" already exists
Run Code Online (Sandbox Code Playgroud)

Eel*_*lke 9

pg_dump的默认输出格式实际上是纯文本sql脚本.因此使用psql进行导入或使用-Fc标志进行redump .