Skip to content

Instantly share code, notes, and snippets.

@sriedel
Created January 13, 2011 07:38
Show Gist options
  • Save sriedel/777539 to your computer and use it in GitHub Desktop.
Save sriedel/777539 to your computer and use it in GitHub Desktop.
Remove FK constraints from postgres database
select 'ALTER TABLE ' || t.table_name || ' DROP CONSTRAINT ' || t.constraint_name || ';'
from information_schema.table_constraints t
where t.constraint_type = 'FOREIGN KEY';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment