You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Supposed I have a database dump (content only) that was created via Antares, e.g. for a PostgreSQL database.
When I try to import this dump into an empty database, I may get foreign key constraint violations, when there are INSERT statements that refer to primary IDs that are INSERTed later.
One reason is that Antares exports the tables in alphabetical order, not in order of dependency.
Describe the solution you'd like
The dump should contain statements that disable foreign key constraints at the beginning, and enable the constraints again at the end.
I see two ways for PostgreSQL but are not sure if this would be the best way.
Is your feature request related to a problem? Please describe.
Supposed I have a database dump (content only) that was created via Antares, e.g. for a PostgreSQL database.
When I try to import this dump into an empty database, I may get foreign key constraint violations, when there are INSERT statements that refer to primary IDs that are INSERTed later.
One reason is that Antares exports the tables in alphabetical order, not in order of dependency.
Describe the solution you'd like
The dump should contain statements that disable foreign key constraints at the beginning, and enable the constraints again at the end.
I see two ways for PostgreSQL but are not sure if this would be the best way.
SET session_replication_role = replica;
and afterwardsSET session_replication_role = DEFAULT;
. See https://stackoverflow.com/questions/3942258/how-do-i-temporarily-disable-triggers-in-postgresql or https://postgresqlco.nf/doc/en/param/session_replication_role/.ALTER TABLE tab_name DISABLE TRIGGER ALL;
and afterwardsALTER TABLE tab_name ENABE TRIGGER ALL;
. See also https://stackoverflow.com/questions/3942258/how-do-i-temporarily-disable-triggers-in-postgresql or https://www.commandprompt.com/education/how-to-disable-a-trigger-in-postgresql/.Describe alternatives you've considered
An alternative would be sorting the tables in the dump in order of dependency, but this seems quite hard.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: