2004-11-24 17:32:10 +01:00
|
|
|
-- source include/have_innodb.inc
|
2004-12-30 23:44:00 +01:00
|
|
|
--disable_warnings
|
|
|
|
DROP TABLE IF EXISTS t1,t2;
|
|
|
|
--enable_warnings
|
2004-11-24 17:32:10 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Test for KEY_COLUMN_USAGE & TABLE_CONSTRAINTS tables
|
|
|
|
#
|
|
|
|
|
|
|
|
CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
|
2005-05-20 14:39:28 +02:00
|
|
|
CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id, id),
|
2004-11-24 17:32:10 +01:00
|
|
|
FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE,
|
|
|
|
FOREIGN KEY (t1_id) REFERENCES t1(id) ON UPDATE CASCADE) ENGINE=INNODB;
|
2005-05-20 14:39:28 +02:00
|
|
|
|
|
|
|
CREATE TABLE t3 (id INT PRIMARY KEY, t2_id INT, INDEX par_ind (t2_id),
|
|
|
|
FOREIGN KEY (id, t2_id) REFERENCES t2(t1_id, id) ON DELETE CASCADE) ENGINE=INNODB;
|
|
|
|
|
2004-11-24 17:32:10 +01:00
|
|
|
select * from information_schema.TABLE_CONSTRAINTS where
|
|
|
|
TABLE_SCHEMA= "test";
|
|
|
|
select * from information_schema.KEY_COLUMN_USAGE where
|
|
|
|
TABLE_SCHEMA= "test";
|
|
|
|
|
2005-05-20 14:39:28 +02:00
|
|
|
drop table t3, t2, t1;
|