pg_restore,违反了恢复对RD的外键约束
一直试图将转储恢复到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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论