Title: Though foreign key constraint exists no error displayed while dropping database Bug ID: Description: If a table field is being referred as foreign key by multiple tables where one is from the same database and the other is from other database then when we try to delete the first database, no error is displayed and the database is deleted. Date: 05/03/2005 Build # / Version: MySQL 5.0.4-beta-nt OS: Windows Server 2003 Component: Foreign Key Constraints Test case #: Test Setup: Machine1 with MySQL server installed and running Priority: 2 Severity: 2 Repro Steps: 1. Start the MySQL client and connect to the database server. 2. Set the delimiter to // 3. Run the following commands to create and use a database. drop database if exists db1// create database db1// use db1// 4. Now using the following commands create two tables where the second table has a foreign key reference to the first table as follows: drop table if exists course// create table course( id int, courcename char(100) not null, duration int not null, primary key (id) ) engine=innodb// insert into course values(1,'system design',4), (2,'database system',6), (3,'operating system',16)// drop table if exists students// create table students(id int not null, name char(100) not null, course_id int, foreign key (course_id) references course(id) on delete set null ) engine=innodb// insert into students values(1,'l',1), (2,'m',1), (3,'n',2), (4,'o',3), (5,'p',3), (6,'q',1)// 5. Now crate another database and create another table in the database having foreign key reference to the table created in step 4 as follows: drop database if exists db2// create database db2// drop table if exists db2.trainers// create table db2.trainers( id int not null, name char(100) not null, course_id int, foreign key (course_id) references db1.course(id) on delete set null ) engine=innodb// insert into db2.trainers values(1,'a',1), (2,'b',1), (3,'c',2), (4,'d',3), (5,'e',3), (6,'f',1)// select * from db2.trainers// 6. To verify that the foreign key constraint is working delete a row form the course table and verify the contents of trainers table as follows: delete from db1.course where id=1// select * from db2.trainers// 7. Now try to drop database db1 as follows: drop database if exists db1// Expected Results: 1. Appropriate error should be displayed as foreign key constraint exists. Actual Results: 1. No error is displayed and the database is deleted without error. Additional information: In the above scenarios, if we do not create the table 'students' in db1 and then at the end try to drop database db1, then appropriate error is displayed. Attachments: Please refer to the attached command output file for more details. 1. ‘Though foreign key constraint exists - Command Output.txt’