'pg_restore, violates foreign key constraint restoring to RDS
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?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|