You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

9 lines
362 B

  1. SET foreign_key_checks=0;
  2. CREATE TABLE t1 (id int, foreign key (id) references t2(id)) ENGINE=INNODB;
  3. CREATE TABLE t2 (id int, foreign key (id) references t1(id)) ENGINE=INNODB;
  4. SET foreign_key_checks=1;
  5. SELECT COUNT(*) FROM information_schema.key_column_usage WHERE REFERENCED_TABLE_NAME in ('t1', 't2');
  6. COUNT(*)
  7. 2
  8. SET foreign_key_checks=0;
  9. DROP TABLE t1, t2;