| 1 |
# |
| 2 |
# Bug #57904 Missing constraint from information schema REFERENTIAL_CONSTRAINTS table |
| 3 |
# |
| 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 |
|
| 21 |
--sorted_result |
| 22 |
query_vertical SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS |
| 23 |
WHERE table_name = 'product_order'; |
| 24 |
|
| 25 |
DROP TABLE product_order; |
| 26 |
DROP TABLE product; |
| 27 |
DROP TABLE customer; |
| 28 |
|