Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 13286 invoked from network); 9 Dec 2008 13:21:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Dec 2008 13:21:06 -0000 Received: (qmail 12664 invoked by uid 500); 9 Dec 2008 13:21:19 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 12639 invoked by uid 500); 9 Dec 2008 13:21:19 -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 12628 invoked by uid 99); 9 Dec 2008 13:21:18 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Dec 2008 05:21:18 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Dec 2008 13:19:55 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 5FA9E234C2B7 for ; Tue, 9 Dec 2008 05:20:44 -0800 (PST) Message-ID: <700185041.1228828844390.JavaMail.jira@brutus> Date: Tue, 9 Dec 2008 05:20:44 -0800 (PST) From: "Rick Hillegas (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Closed: (DERBY-3968) Foreign keys accept the ON DELETE SET DEFAULT clause but do not enforce it In-Reply-To: <1639770200.1228238924267.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-3968?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Rick Hillegas closed DERBY-3968. -------------------------------- Resolution: Duplicate > Foreign keys accept the ON DELETE SET DEFAULT clause but do not enforce it > -------------------------------------------------------------------------- > > Key: DERBY-3968 > URL: https://issues.apache.org/jira/browse/DERBY-3968 > Project: Derby > Issue Type: Bug > Components: SQL > Affects Versions: 10.4.2.0, 10.5.0.0 > Reporter: Rick Hillegas > > The Derby Reference Guide does not document that you can declare a foreign key with ON DELETE SET DEFAULT. However, Derby accepts this syntax. There are no tests for this clause and it does not seem to work. A simple solution would be to forbid this syntax. The following test case shows this problem: > ij> drop table t_dhw_4; > 0 rows inserted/updated/deleted > ij> drop table t_dhw_3; > 0 rows inserted/updated/deleted > ij> create table t_dhw_3( a int primary key ); > 0 rows inserted/updated/deleted > ij> create table t_dhw_4( a int references t_dhw_3( a ) on delete set default default 2, b int ); > 0 rows inserted/updated/deleted > ij> insert into t_dhw_3( a ) values ( 1 ), ( 2 ); > 2 rows inserted/updated/deleted > ij> insert into t_dhw_4( a ) values( 1 ); > 1 row inserted/updated/deleted > ij> insert into t_dhw_4( b ) values( 200 ); > 1 row inserted/updated/deleted > ij> select * from t_dhw_3 order by a; > A > ----------- > 1 > 2 > 2 rows selected > ij> select * from t_dhw_4 order by a; > A |B > ----------------------- > 1 |NULL > 2 |200 > 2 rows selected > ij> delete from t_dhw_3 where a = 1; > ERROR 23503: DELETE on table 'T_DHW_3' caused a violation of foreign key constraint 'SQL081202092741910' for key (1). The statement has been rolled back. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.