是否可以重建 pg_depend? [英] Is it possible to rebuild pg_depend?

查看:53
本文介绍了是否可以重建 pg_depend?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 PostgreSQL 9.4 数据库受到 BDR:

I have a PostgreSQL 9.4 database affected by the following bug in BDR:

https://github.com/2ndQuadrant/bdr/issues/309

简而言之,BDR 中的错​​误导致 pg_depend 系统目录.现在,当我使用 pg_dump 时,对象被乱序转储,如果没有手动编辑就无法使用转储.

In a nutshell, that bug in BDR resulted in missing dependencies in the pg_depend system catalog. Now when I use pg_dump, objects are dumped out of order and the dump can't be used without manual editing.

有没有办法让PostgreSQL重建pg_depend中的依赖,而不用从头重建数据库?

Is there a way to make PostgreSQL rebuild the dependencies in pg_depend without rebuilding the database from scratch?

推荐答案

不,因为该信息不是多余的(那会是一个问题).

No, because that information is not redundant (that would be a problem).

手动处理 pg_depend 可能会让事情变得更糟.

Manually messing with pg_depend is likely to make things worse.

最好的办法是创建一个仅模式转储 (pg_dump --section=pre-data) 并手动对其进行按摩,直到您可以将其加载到新数据库中(某些依赖项仍将是丢失,例如拥有序列的列).

Your best bet is to create a schema-only dump (pg_dump --section=pre-data) and massage that manually until you can load it into a new database (some dependencies will still be lost, e.g. columns owning a sequence).

一旦你成功了,使用 ALTER 语句来调整你发现缺少的其他依赖项.

Once you have succeeded with that, use ALTER statements to adjust further dependencies you notice are missing.

对结果满意后,转储数据库的其余部分(pg_dump --section=datapg_dump --section=post-data)并恢复它们按此顺序进入数据库.

Once you are happy with the result, dump the rest of the database (pg_dump --section=data and pg_dump --section=post-data) and restore them into the database in this order.

恐怕你不能做得更好.

这篇关于是否可以重建 pg_depend?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆