FK question, 2.3.3

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

FK question, 2.3.3

Brian Young-4
I am in the early stages of updating to 2.3.3.   So far I am dealing with some unit test failures in our codebase after the update.

The unit test deletes a row from the table in question, and it is failing with 2.3.3:
org.hsqldb.HsqlException: integrity constraint violation: foreign key no action; SYS_FK_10265 table: MYTABLE

There are a few other tables that have a foreign key to this table and they declare:
FOREIGN KEY (mytable_id) REFERENCES mytable(id) ON DELETE CASCADE

Also MYTABLE has a couple of foreign keys, the only one that might be notable is a self reference, e.g.

CREATE CACHED TABLE mytable (
id INTEGER GENERATED BY DEFAULT AS SEQUENCE seq_mytable_id PRIMARY KEY,
 ...
alias_of INTEGER NOT NULL,
FOREIGN KEY (alias_of) REFERENCES mytable(id)

I saw a couple references to FK handling in the 2.3.3 release notes and assume perhaps our DB was doing something wrong all along and it is just now being caught, but I'm not sure what it might be.

Thanks,
Brian


------------------------------------------------------------------------------

_______________________________________________
Hsqldb-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/hsqldb-user
Reply | Threaded
Open this post in threaded view
|

Re: FK question, 2.3.3

Fred Toussi-2
In version 2.3.3, foreign keys with NO ACTION (the default form) work better in the sense that in complex cases they allow deletes when parent and child are both deleted in the same operation.
 
As this is a support question, please narrow down the issue and report in the Help Forum to follow up. Check the INFORMATION_SCHEMA tables to find out which FK is being violated.
 
This mailing list is for simple questions and announcements.
 
Fred
 
On Thu, Jul 23, 2015, at 01:01, Brian Young wrote:
I am in the early stages of updating to 2.3.3.   So far I am dealing with some unit test failures in our codebase after the update.
 
The unit test deletes a row from the table in question, and it is failing with 2.3.3:
org.hsqldb.HsqlException: integrity constraint violation: foreign key no action; SYS_FK_10265 table: MYTABLE
 
There are a few other tables that have a foreign key to this table and they declare:
FOREIGN KEY (mytable_id) REFERENCES mytable(id) ON DELETE CASCADE
 
Also MYTABLE has a couple of foreign keys, the only one that might be notable is a self reference, e.g.
 
CREATE CACHED TABLE mytable (
id INTEGER GENERATED BY DEFAULT AS SEQUENCE seq_mytable_id PRIMARY KEY,
 ...
alias_of INTEGER NOT NULL,
FOREIGN KEY (alias_of) REFERENCES mytable(id)
 
I saw a couple references to FK handling in the 2.3.3 release notes and assume perhaps our DB was doing something wrong all along and it is just now being caught, but I'm not sure what it might be.
 
Thanks,
Brian
 
------------------------------------------------------------------------------
_______________________________________________
Hsqldb-user mailing list

------------------------------------------------------------------------------

_______________________________________________
Hsqldb-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/hsqldb-user