Is there an equivalent function or workaround to realize DB2´s RESTRICT ON DROP
attribute in PostgreSQL 9.5 or later?
Asked
Active
Viewed 111 times
0

StanWell
- 35
- 4
-
This is a hack, so I won't put it into an answer. Create another table and define the PK of the table you want to protect as an FK reference. Why would you not enforce this with roles/permissions? – Mike Organek Sep 03 '20 at 15:09
-
Nice idea, but not an option for about 50+ tables. It´s not a permissions issue. I used that feature in DB2 to prevent people (which have permissions) from "accidently" dropping a table. – StanWell Sep 03 '20 at 15:14
-
What does it do? – Sep 03 '20 at 15:19
-
You can add as many columns as FKs to that other table as you want. – Mike Organek Sep 03 '20 at 15:29