db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dag H. Wanvik (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (DERBY-6527) Fix errors in foreign keys documentation
Date Tue, 06 May 2014 22:30:16 GMT

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

Dag H. Wanvik edited comment on DERBY-6527 at 5/6/14 10:30 PM:
---------------------------------------------------------------

Running the script below:
{code}
connect 'jdbc:derby:memory:wombat;create=true';
autocommit off;
create table t(i int primary key);
create table t2(i int unique, constraint c1 foreign key(i) references t(i) on delete set null);
create table t3(i int, constraint c2 foreign key(i) references t2(i) on update no action /*
or RESTRICT */ );
insert into t values 1;
insert into t2 values 1;
insert into t3 values 1;
delete from t;
{code}
gave this error on the delete:
{code}
ERROR 23503: UPDATE on table 'T2' caused a violation of foreign key constraint 'C2' for key
(1).  The statement has been rolled back.
{code}
so, it seems this can't happen:
{quote}
(Again, if the dependent table also has dependent tables,
 nullable columns in those tables' foreign keys are also set to null.) 
{quote}

If we allowed UP UPDATE SET NULL, it would make sense.


was (Author: dagw):
Running the script below:
{code}
connect 'jdbc:derby:memory:wombat;create=true';
autocommit off;
create table t(i int primary key);
create table t2(i int unique, constraint c1 foreign key(i) references t(i) on delete set null);
create table t3(i int, constraint c2 foreign key(i) references t2(i) on update no action /*
or RESTRICT */ );
insert into t values 1;
insert into t2 values 1;
insert into t3 values 1;
delete from t;
{code}
gave this error on the delete:
{code}
ERROR 23503: UPDATE on table 'T2' caused a violation of foreign key constraint 'C2' for key
(1).  The statement has been rolled back.
{code}
so, it seems this can't happen:
{quote}
(Again, if the dependent table also has dependent tables,
 nullable columns in those tables' foreign keys are also set to null.) 
{quote}


> 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
>
> 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)

Mime
View raw message