pg_restore,违反了恢复对RD的外键约束

发布于 2025-01-26 06:20:15 字数 904 浏览 5 评论 0原文

一直试图将转储恢复到AWS RDS实例中。 无论我尝试什么,我最终都会使用相同的错误类型。

    pg_restore: [archiver (db)] COPY failed for table "sample": ERROR:  insert or update on table "sample" violates foreign key constraint "sample_ratio_id_fkey"
DETAIL:  Key (ratio_id)=(1433) is not present in table "ratio".

当表比率尚未恢复时,这种情况发生。

我尝试使用pg_restore-disable -tiggers -s Postgres尝试禁用触发器,但我收到了拒绝的权限。

    pg_restore: [archiver (db)] Error from TOC entry 6256; 0 18996 TABLE DATA sample
    pg_restore: [archiver (db)] could not execute query: ERROR:  permission denied: "RI_ConstraintTrigger_c_26462" is a system trigger
        Command was: ALTER TABLE sample DISABLE TRIGGER ALL;

查看数据库,用户postgres没有superuser特权,拥有它们的是rdsadmin,但我没有(我认为我认为我不应该)访问它。

我应该如何还原数据?在AWS RDS实例上使用PG_RESTORE时,有没有办法克服约束?

Been trying to restore a dump into a AWS RDS instance.
No matter what I try I end up with the same error type.

    pg_restore: [archiver (db)] COPY failed for table "sample": ERROR:  insert or update on table "sample" violates foreign key constraint "sample_ratio_id_fkey"
DETAIL:  Key (ratio_id)=(1433) is not present in table "ratio".

This happens as the table ratio hasn't been restored yet.

I have tried disabling the triggers using pg_restore --disable-triggers -S postgres but I receive a permission denied.

    pg_restore: [archiver (db)] Error from TOC entry 6256; 0 18996 TABLE DATA sample
    pg_restore: [archiver (db)] could not execute query: ERROR:  permission denied: "RI_ConstraintTrigger_c_26462" is a system trigger
        Command was: ALTER TABLE sample DISABLE TRIGGER ALL;

Looking into the database, the user postgres does not have superuser privileges, the one that have them is rdsadmin but I dont have (and i think i shouldn't have) access to it.

How should I restore the data? Is there a way to overcome the constraints while using pg_restore on a AWS RDS instance?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文