Created
June 27, 2015 23:01
-
-
Save sebastianwebber/77b2567cea5ad4384f39 to your computer and use it in GitHub Desktop.
Trabalhando com Constraints - PostgreSQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT | |
| 'ALTER TABLE ' || | |
| schema.nspname || '.' || class.relname | |
| || ' DROP CONSTRAINT IF EXISTS ' || | |
| cons.conname || ';' | |
| FROM pg_constraint AS cons | |
| JOIN pg_class AS class on class.oid = cons.conrelid | |
| JOIN pg_namespace AS schema on schema.oid = cons.connamespace | |
| WHERE schema.nspname = 'schema' | |
| AND class.relname = 'tabela'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment