I have a situation where a foreign key constraint is not correctly checked with 1.1.102 when using a memory database (jdbc:h2:mem:...).
In the sample (see below) a "DELETE FROM company" is correctly giving an error, but when running a "DELETE FROM person", the rows are deleted even though they are still referenced. This is working correctly with 1.0.79 and only happens with memory databases in 1.1.102. When using a file based DB it also throws the correct error with 1.1.102 Regards Thomas Here is the test script: create table person (person_id integer primary key, firstname varchar(100), lastname varchar(100)); create table address (address_id integer primary key, address varchar(50)); create table company (company_id integer primary key, company_name varchar(50)); create table person_company (person_id integer, company_id integer, primary key (person_id, company_id)); create table person_address (person_id integer, address_id integer, primary key (person_id, address_id)); alter table person_company add constraint fk_pc_p foreign key (person_id) references person(person_id); alter table person_company add constraint fk_pc_c foreign key (company_id) references company (company_id); alter table person_address add constraint fk_pa_p foreign key (person_id) references person(person_id); alter table person_address add constraint fk_pa_a foreign key (address_id) references address (address_id); insert into person values (1, 'Arthur', 'Dent'); insert into person values (2, 'Ford', 'Prefect'); insert into person values (3, 'Zaphod', 'Beeblebrox'); insert into person values (4, 'Tricia', 'McMillian'); insert into address values (1, 'Arthur''s Home'); insert into address values (2, 'Ford''s Home'); insert into address values (3, 'Zaphod''s Home'); insert into person_address values (1, 1); insert into person_address values (2, 2); insert into person_address values (3, 3); insert into person_address values (4, 3); insert into company (company_id, company_name) values (1, 'Road construction'); insert into company (company_id, company_name) values (2, 'h2g'); insert into person_company (person_id, company_id) values (1, 2); insert into person_company (person_id, company_id) values (2, 2); commit; --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/h2-database?hl=en -~----------~----~----~----~------~----~------~--~---
