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-6665) Violation of deferred constraints not detected when conglomerates are erroneously shared
Date Tue, 29 Jul 2014 12:29:39 GMT

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

Dag H. Wanvik edited comment on DERBY-6665 at 7/29/14 12:28 PM:
----------------------------------------------------------------

Attaching a patch that corrects a hole in the logic that should have prevented deferrable
constraint supporting indexes to be shared (the current implementation restriction). This
corrects the repro errors seen in this issue (but not the error in DERBY-6670 - I'll handle
that separately).

Moving from using the conglomerate id to the constraint UUID in the maps internally is probably
a good idea going forward, though. I had already made one attempt to do this, but it turned
out to have some complexities which made me abandon that approach. I suggest we defer that
refactoring until after the release. Running regressions on this patch.



was (Author: dagw):
Attaching a patch that corrects a hole in the logic that should have prevented deferrable
constraint supporting indexes to be shared (the current implementation restriction). This
corrects the repro errors seen in this issue (but not the error in DERBY-6670 - I'll handle
that separately).

Moving from using the shared conglomerate id to the constraint UUID in the maps internally
is probably a good idea going forward, though. I had already made one attempt to do this,
but it turned out to have some complexities which made me abandon that approach. I suggest
we defer that refactoring until after the release. Running regressions on this patch.


> Violation of deferred constraints not detected when conglomerates are erroneously shared
> ----------------------------------------------------------------------------------------
>
>                 Key: DERBY-6665
>                 URL: https://issues.apache.org/jira/browse/DERBY-6665
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.11.0.0
>            Reporter: Knut Anders Hatlen
>         Attachments: braindump.diff, derby-6665-01-aa-remove-uniquePKConstraintModes.diff,
derby-6665-01-ab-useTableUUIDforCheckConstraints.diff, derby-6665-01-ac-unpositionedScan.diff,
derby-6665-01-ad-import-and-unique.diff, derby-6665-01-ae-deferredCheckAndDroppedFK.diff,
derby-6665-dhw-dont-share.diff, junit.diff
>
>
> See the following script:
> {noformat}
> ij version 10.11
> ij> connect 'jdbc:derby:memory:db;create=true';
> ij> create table t1(x int primary key);
> 0 rows inserted/updated/deleted
> ij> create table t2(x int primary key);
> 0 rows inserted/updated/deleted
> ij> create table t3(x int, constraint fk1 foreign key (x) references t1 initially
deferred, constraint fk2 foreign key (x) references t2 initially deferred);
> 0 rows inserted/updated/deleted
> ij> insert into t1 values 1;
> 1 row inserted/updated/deleted
> ij> autocommit off;
> ij> insert into t3 values 1;
> 1 row inserted/updated/deleted
> ij> insert into t2 values 1;
> 1 row inserted/updated/deleted
> ij> delete from t1;
> 1 row inserted/updated/deleted
> ij> commit;
> ij> select * from t1;
> X          
> -----------
> 0 rows selected
> ij> select * from t2;
> X          
> -----------
> 1          
> 1 row selected
> ij> select * from t3;
> X          
> -----------
> 1          
> 1 row selected
> {noformat}
> Since T3.X contains a value (1) that is not present in T1, the foreign key FK1 is violated,
and the COMMIT statement should have failed.



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

Mime
View raw message