且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

postgresql 关于删除级联

更新时间:2023-02-02 22:58:19

我猜你误会了.尝试删除 TableY 中的行,TableX 中的相应行将被级联删除.当您有次要相关表并希望通过从主表中删除父行来清理它们而不违反约束或留下垃圾时,此选项是必不可少的.

I guess you got misunderstanding. Try to delete row from TableY and corresponding rows from TableX will be cascade deleted. This option is indispensable when you have secondary related tables and would like to clean them all by deleting parent row from primary table without getting constraints violated or rubbish left.