[ 
https://issues.apache.org/jira/browse/DERBY-6527?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13993019#comment-13993019
 ] 

Dag H. Wanvik commented on DERBY-6527:
--------------------------------------

Referring back to this part of the thread:
{quote}
 > Each referential constraint in which a table is a parent has its own
 > delete rule; all applicable delete rules are used to determine the
 > result of a delete operation. Thus, a row cannot be deleted if it has
 > dependents in a referential constraint with a delete rule of RESTRICT
 > or NO ACTION.

Not true?: In the NO ACTION case, a BEFORE trigger could cause the
dependent row to be deleted, thus reestablishing harmony..

 > Similarly, a row cannot be deleted if the deletion cascades to any of
 > its descendants that are dependents in a referential constraint with
 > the delete rule of RESTRICT or NO ACTION.

Same proviso as above 
{quote}
I still think the statement is "not always true" for the case of NO ACTION for 
the reason I indicated: a before trigger might change things by deleting the 
dependent row so that the delete pf the referenced row is ok.
But if one or more of the referential constraints are RESTRICT, it would be 
true always.

In the second case, we have essentially the same situation except the initial 
delete here is caused by the cascade operation: descendant rows cannot be 
deleted if they, in turn, have an FK on them that are RESTRICT. If the only 
have NO ACTION, it would depend on any before triggers as above.

Btw, I discovered that the section completely omits to state that the default 
action for ON DELETE as well as for ON UPDATE is "NO ACTION". I think this 
should be made explicit early on.

> Fix errors in foreign keys documentation
> ----------------------------------------
>
>                 Key: DERBY-6527
>                 URL: https://issues.apache.org/jira/browse/DERBY-6527
>             Project: Derby
>          Issue Type: Bug
>          Components: Documentation
>    Affects Versions: 10.10.1.1
>            Reporter: Dag H. Wanvik
>            Assignee: Kim Haase
>         Attachments: DERBY-6527.diff, rrefsqlj13590.html
>
>
> Cf this email thread: 
> http://apache-database.10148.n7.nabble.com/Foreign-key-semantics-as-documented-td138227.html
> Our documentation in the reference manual on foreign keys/referential actions 
> has errors.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to