PostgreSQL drop constraint with unknown name
问题 I have an SQL script that needs to drop several constraints and restore them at the end, but the constraint names are auto-generated and will be different each time the script is run. I know how to get the constraint name from the table names, but it doesn't seem possible to use this information in the drop statement. select conname from pg_constraint where conrelid = (select oid from pg_class where relname='table name') and confrelid = (select oid from pg_class where relname='reference table