sql query

In version 3.23.49a when using an innodb table, "alter table" appears to 
corrupt foreign key constraints.  Try the following test case:

"
create table test_base (
        base_id int not null,
        primary key (base_id)
) type = innodb;

create table test_ref (
        base_id int not null,
        ref_id int not null,
        primary key (base_id, ref_id),
        foreign key (base_id) references test_base (base_id)
) type = innodb;

insert test_base (base_id) values (1);
insert test_ref (base_id, ref_id) values (1, 1);

alter table test_base add column value int not null;

insert test_ref (base_id, ref_id) values (1, 2);
"

The final insert fails with
"
mysql> insert test_ref (base_id, ref_id) values (1, 2);
ERROR 1216: Cannot add a child row: a foreign key constraint fails
"

which suggests that the foreign key constraint has become hosed?

Chuck


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to