Return-Path: X-Original-To: apmail-db-derby-dev-archive@www.apache.org Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 89FB2112E7 for ; Mon, 12 May 2014 12:49:55 +0000 (UTC) Received: (qmail 85058 invoked by uid 500); 12 May 2014 12:43:15 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 85032 invoked by uid 500); 12 May 2014 12:43:15 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 84905 invoked by uid 99); 12 May 2014 12:43:15 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 May 2014 12:43:15 +0000 Date: Mon, 12 May 2014 12:43:14 +0000 (UTC) From: "Dag H. Wanvik (JIRA)" To: derby-dev@db.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (DERBY-6527) Fix errors in foreign keys documentation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ 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:41 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 (referencing) row is *deleted*, there is (trivially) no problem, since there is no longer a FK to check. 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 (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.. > 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)