Is it possible to rebuild pg_depend?

自闭症网瘾萝莉.ら 提交于 2021-01-29 09:31:14

问题


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

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

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.

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


回答1:


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

Manually messing with pg_depend is likely to make things worse.

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).

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

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.

I'm afraid you cannot do better than that.



来源:https://stackoverflow.com/questions/55709772/is-it-possible-to-rebuild-pg-depend

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!