使用 on restrict constraint postgres 删除

Deletion with on restrict constraint postgres

如果有restrict约束,是否可以在postgres中删除行"on cascade"? 是否可以将所有限制约束自动更改为级联约束?

两者都不可能。您的选择是:

  • DROP CONSTRAINTDELETEADD CONSTRAINT

  • DROP CONSTRAINTADD CONSTRAINT ... ON DELETE CASCADEDELETE

从 PostgreSQL 文档中,您可以看到可以对 table 约束进行哪些更改: I. SQL Commands - ALTER TABLE