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.

27 lines
906 B

  1. --source include/have_innodb.inc
  2. #
  3. # Bug #57904 Missing constraint from information schema REFERENTIAL_CONSTRAINTS table
  4. #
  5. CREATE TABLE product (category INT NOT NULL, id INT NOT NULL,
  6. price DECIMAL, PRIMARY KEY(category, id)) ENGINE=INNODB;
  7. CREATE TABLE customer (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
  8. CREATE TABLE product_order (no INT NOT NULL AUTO_INCREMENT,
  9. product_category INT NOT NULL,
  10. product_id INT NOT NULL,
  11. customer_id INT NOT NULL,
  12. PRIMARY KEY(no),
  13. INDEX (product_category, product_id),
  14. FOREIGN KEY (product_category, product_id)
  15. REFERENCES product(category, id) ON UPDATE CASCADE ON DELETE RESTRICT,
  16. INDEX (customer_id),
  17. FOREIGN KEY (customer_id)
  18. REFERENCES customer(id)
  19. ) ENGINE=INNODB;
  20. query_vertical SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS
  21. WHERE table_name = 'product_order';
  22. DROP TABLE product_order;
  23. DROP TABLE product;
  24. DROP TABLE customer;