mariadb/mysql-test/t/information_schema_inno.test
unknown 79cc1546b2 WL#2257 REFERENTIAL_CONSTRAINTS view
added I_S.REFARENTIAL_CONSTRAINTS table


mysql-test/r/information_schema.result:
  WL#2257 REFERENTIAL_CONSTRAINTS view
   result fix
mysql-test/r/information_schema_db.result:
  WL#2257 REFERENTIAL_CONSTRAINTS view
   result fix
mysql-test/r/information_schema_inno.result:
  WL#2257 REFERENTIAL_CONSTRAINTS view
   test case
mysql-test/t/information_schema_inno.test:
  WL#2257 REFERENTIAL_CONSTRAINTS view
   test case
sql/ha_innodb.cc:
  WL#2257 REFERENTIAL_CONSTRAINTS view
2006-05-02 16:31:39 +05:00

55 lines
2.1 KiB
Text

-- source include/have_innodb.inc
--disable_warnings
DROP TABLE IF EXISTS t1,t2,t3;
--enable_warnings
#
# Test for KEY_COLUMN_USAGE & TABLE_CONSTRAINTS tables
#
CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id, id),
FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE,
FOREIGN KEY (t1_id) REFERENCES t1(id) ON UPDATE CASCADE) ENGINE=INNODB;
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;
select * from information_schema.TABLE_CONSTRAINTS where
TABLE_SCHEMA= "test";
select * from information_schema.KEY_COLUMN_USAGE where
TABLE_SCHEMA= "test";
drop table t3, t2, t1;
#
# Test for REFERENTIAL_CONSTRAINTS table
#
CREATE TABLE t1(a1 INT NOT NULL, a2 INT NOT NULL,
PRIMARY KEY(a1, a2)) ENGINE=INNODB;
CREATE TABLE t2(b1 INT, b2 INT, INDEX (b1, b2),
CONSTRAINT A1
FOREIGN KEY (b1, b2) REFERENCES t1(a1, a2)
ON UPDATE CASCADE ON DELETE NO ACTION) ENGINE=INNODB;
CREATE TABLE t3(b1 INT, b2 INT, INDEX (b1, b2),
CONSTRAINT A2
FOREIGN KEY (b1, b2) REFERENCES t2(b1, b2)
ON UPDATE SET NULL ON DELETE RESTRICT) ENGINE=INNODB;
CREATE TABLE t4(b1 INT, b2 INT, INDEX (b1, b2),
CONSTRAINT A3
FOREIGN KEY (b1, b2) REFERENCES t3(b1, b2)
ON UPDATE NO ACTION ON DELETE SET NULL) ENGINE=INNODB;
CREATE TABLE t5(b1 INT, b2 INT, INDEX (b1, b2),
CONSTRAINT A4
FOREIGN KEY (b1, b2) REFERENCES t4(b1, b2)
ON UPDATE RESTRICT ON DELETE CASCADE) ENGINE=INNODB;
select a.CONSTRAINT_SCHEMA, b.TABLE_NAME, CONSTRAINT_TYPE,
b.CONSTRAINT_NAME, UNIQUE_CONSTRAINT_SCHEMA, UNIQUE_CONSTRAINT_NAME,
MATCH_OPTION, UPDATE_RULE, DELETE_RULE
from information_schema.TABLE_CONSTRAINTS a,
information_schema.REFERENTIAL_CONSTRAINTS b
where a.CONSTRAINT_SCHEMA = 'test' and a.CONSTRAINT_SCHEMA = b.CONSTRAINT_SCHEMA and
a.CONSTRAINT_NAME = b.CONSTRAINT_NAME;
drop tables t5, t4, t3, t2, t1;