postgresql – 当有警告时,pg_restore的退出代码问题

栏目: 数据库 · PostgreSQL · 发布时间: 7年前

内容简介:如果目标数据库的表只与转储中的表部分重叠,那么使用pg_restore可能会让人感到痛苦.使用–clean标志只能部分解决问题,但您可能仍会遇到不存在的表的错误.在我看来,最好的方法是删除目标数据库(或删除级联目标模式)并继续执行还原.

命令:

bin/pg_dump -b -o -Fc -Z 0 -p 5333 -U user template1 -f db.dump
bin/pg_restore -c  -h localhost -p 5333 -U user -d template1 db.dump

步骤如下:

>将新表添加到DB并进行转储

>删除新添加的表

>尝试使用转储文件进行恢复

>使用代码1恢复退出但仍然可以成功恢复表.

error in pg_restore:

pg_restore: [archiver (db)] could not execute query: err-1: table “test1” does not exist

Command was: DROP TABLE public.test1;

WARNING: errors ignored on restore: 2

这是带有表添加/删除步骤的转储/恢复功能的预期行为吗?

如果目标数据库的表只与转储中的表部分重叠,那么使用pg_restore可能会让人感到痛苦.

使用–clean标志只能部分解决问题,但您可能仍会遇到不存在的表的错误.

在我看来,最好的方法是删除目标数据库(或删除级联目标模式)并继续执行还原.

您可能想要查看类似的问题: will pg_restore overwrite the existing tables?

翻译自:https://stackoverflow.com/questions/28023837/issue-with-pg-restore-s-exit-code-when-warnings-are-there


以上所述就是小编给大家介绍的《postgresql – 当有警告时,pg_restore的退出代码问题》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Bandit Algorithms for Website Optimization

Bandit Algorithms for Website Optimization

John Myles White / O'Reilly Media / 2013-1-3 / USD 19.99

This book shows you how to run experiments on your website using A/B testing - and then takes you a huge step further by introducing you to bandit algorithms for website optimization. Author John Myle......一起来看看 《Bandit Algorithms for Website Optimization》 这本书的介绍吧!

SHA 加密
SHA 加密

SHA 加密工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具