pg_restore toc错误

时间:2012-03-23 09:19:35

标签: postgresql pg-dump pg-restore

我使用以下语法进行pg_dump和恢复

pg_dump eval --inserts -b -c --encoding UTF8 -Fc -f eval.sql.tar.gz -x -U postgres
createdb -T template0 test -U postgres
pg_restore -d test eval.sql.tar.gz -e -U postgres

转储是成功的,没有错误,但是恢复会产生一些错误,我正在使用相同的用户和特权在同一台机器上转储和恢复...

我已尝试过其他格式,普通,tar,压缩都会得到相同的错误..

我的pg版本是8.4.11,psql版本是8.4.11

我不确定是什么造成了这些错误..任何人都可以帮助我

 pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 4965; 0 138871 TABLE DATA ir_act_report_xml insigni
pg_restore: [archiver (db)] could not execute query: ERROR:  invalid input syntax for integer: "purchase.order"
LINE 1: ...st for Quotation', 'ir.actions.report.xml', NULL, 'purchase....
                                                             ^
    Command was: INSERT INTO ir_act_report_xml VALUES (350, 'Request for Quotation', 'ir.actions.report.xml', NULL, 'purchase.order', 'purcha...

3 个答案:

答案 0 :(得分:24)

这就是诀窍

pg_dump database_name -c -Ft -f file_name.tar 

pg_restore -d database_name -c file_name.tar

在此之前,我试图恢复,包括-c(干净)

即使-c包含在pg_dump中,它也不会在pg_restore中使用,除非我们说要使用...

答案 1 :(得分:11)

我案中的解决方案:

pg_restore --verbose --clean --no-acl --no-owner -h localhost -U username -d database_name dump_name.dump

答案 2 :(得分:0)

This 为我工作:

增加 max_wal_size 中的 postgresql.conf postgresql 设置(max_wal_size = 2GB)