作者tomex (Tomex Ou)
看板Database
标题Re: [问题] Cascade Delete (FK referencing colum …
时间Mon Jul 16 15:02:50 2007
※ 引述《tomex (Tomex Ou)》之铭言:
: 有人看得懂这篇的问题吗?
: http://forums.devx.com/showthread.php?t=19241
: 回答者的意思不知在讲什麽
: 就需求面上,为什麽不能同时监控两个FK被删除时,一起被删呢?
: 问一些专业的dba,他们只会用sp来解决
: 但这种常态的问题,不能用个案来solve呀!
: 否则我宁愿放弃fk的constraint!
Here is MS's comment on Cascading Deletes
The series of cascading referential actions triggered
by a single DELETE or UPDATE must form a tree
containing no circular references. No table can
appear more than once in the list of all cascading
referential actions that result from the DELETE or
UPDATE. The tree of cascading referential actions
must not have more than one path to any given table.
Any branch of the tree is terminated when it
encounters a table for which NO ACTION has been
specified or is the default.
所以是实作上的问题。
可恶,这实在不合理... 因为在理论上完全可行
母表改了key,就追踪所有子表,把其栏位改值呀!
这在想法上有很难吗?
微软工程师不可能这样就会放弃多个cascading的功能的
一定有怪怪处。
查了FK的Cascading锁定资料,连续超过13小时了
看起来要放弃FK才行。
因为这是很常规的FK基本理论,假如目前资料库系统无法提供简易的solution
我们只好用「假关连」来得灵活。
用sp或trigger都是非正规的方式
毕竟每一个table都写这些鬼东西,就太倚赖且与db绑太深了。
假如你的老师教你FK的理论,记得用这篇基本需求的问题问他呀!
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 220.130.1.144