File: information_schema_inno.result

package info (click to toggle)
mysql-dfsg-5.0 5.0.51a-24%2Blenny5
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 106,168 kB
  • ctags: 94,516
  • sloc: cpp: 447,179; ansic: 411,410; perl: 38,307; sh: 37,449; tcl: 30,484; pascal: 14,851; yacc: 8,559; makefile: 5,078; java: 4,610; xml: 3,953; sql: 2,920; awk: 1,338; asm: 1,061; sed: 772
file content (27 lines) | stat: -rw-r--r-- 1,569 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
DROP TABLE IF EXISTS t1,t2,t3;
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";
CONSTRAINT_CATALOG	CONSTRAINT_SCHEMA	CONSTRAINT_NAME	TABLE_SCHEMA	TABLE_NAME	CONSTRAINT_TYPE
NULL	test	PRIMARY	test	t1	PRIMARY KEY
NULL	test	PRIMARY	test	t2	PRIMARY KEY
NULL	test	t2_ibfk_1	test	t2	FOREIGN KEY
NULL	test	t2_ibfk_2	test	t2	FOREIGN KEY
NULL	test	PRIMARY	test	t3	PRIMARY KEY
NULL	test	t3_ibfk_1	test	t3	FOREIGN KEY
select * from information_schema.KEY_COLUMN_USAGE where
TABLE_SCHEMA= "test";
CONSTRAINT_CATALOG	CONSTRAINT_SCHEMA	CONSTRAINT_NAME	TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	COLUMN_NAME	ORDINAL_POSITION	POSITION_IN_UNIQUE_CONSTRAINT	REFERENCED_TABLE_SCHEMA	REFERENCED_TABLE_NAME	REFERENCED_COLUMN_NAME
NULL	test	PRIMARY	NULL	test	t1	id	1	NULL	NULL	NULL	NULL
NULL	test	PRIMARY	NULL	test	t2	id	1	NULL	NULL	NULL	NULL
NULL	test	t2_ibfk_1	NULL	test	t2	t1_id	1	1	test	t1	id
NULL	test	t2_ibfk_2	NULL	test	t2	t1_id	1	1	test	t1	id
NULL	test	PRIMARY	NULL	test	t3	id	1	NULL	NULL	NULL	NULL
NULL	test	t3_ibfk_1	NULL	test	t3	id	1	1	test	t2	t1_id
NULL	test	t3_ibfk_1	NULL	test	t3	t2_id	2	2	test	t2	id
drop table t3, t2, t1;