[
https://issues.apache.org/jira/browse/DERBY-6527?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13995032#comment-13995032
]
Dag H. Wanvik edited comment on DERBY-6527 at 5/12/14 12:34 PM:
----------------------------------------------------------------
> Thanks, Dag. So I guess I should remove "or NO ACTION" from the two
> sentences. Would that be enough, since > we are clarifying the BEFORE trigger
> situation?
Yes, just remove the NO ACTION. But add: for NO ACTION, the statement is
usually also true, *except* if a trigger would remove the dependent row somehow
(but see below: can't happen in Derby - yet).
As for the default action, what I meant is as follows: If no "ON DELETE" clause
is used, the default action upon a delete of the row containing a referenced
key is NO ACTION. If no "ON UPDATE" clause is specified, the default action
upon a modification of the referenced key is NO ACTION.
If a delete of a child (referenced) row is *deleted*, there is (trivially) no
problem, since there is no longer a referring row.
If the foreign key of a child row is *modified*, the default action is always
NO ACTION, i.e. we do not check of the FK holds until *after* any before
triggers have been executed. Unfortunately, in Derby we do not yet allow
inserts or update in before triggers, so in practice the statement is also true
for NO ACTION... So, I was wrong with regards to the current Derby
implementation, but correct as to the fact there *could* be a difference in
behavior had we implemented the full standard..
was (Author: dagw):
> Thanks, Dag. So I guess I should remove "or NO ACTION" from the two
> sentences. Would that be enough, since > we are clarifying the BEFORE trigger
> situation?
Yes, just remove the NO ACTION. But add: for NO ACTION, the statement is
usually also true, *except* if a trigger would remove the dependent row somehow.
As for the default action, what I meant is as follows: If no "ON DELETE" clause
is used, the default action upon a delete of the row containing a referenced
key is NO ACTION. If no "ON UPDATE" clause is specified, the default action
upon a modification of the referenced key is NO ACTION.
If a delete of a child (referenced) row is *deleted*, there is (trivially) no
problem, since there is no longer a referring row.
If the foreign key of a child row is *modified*, the default action is always
NO ACTION, i.e. we do not check of the FK holds until *after* any before
triggers have been executed. Unfortunately, in Derby we do not yet allow
inserts or update in before triggers, so in practice the statement is also true
for NO ACTION... So, I was wrong with regards to the current Derby
implementation, but correct as to the fact there *could* be a difference in
behavior had we implemented the full standard..
> 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-2.diff, DERBY-6527.diff, rrefsqlj13590.html,
> 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)