Bug #57904 | Missing constraint from information schema REFERENTIAL_CONSTRAINTS table | ||
---|---|---|---|
Submitted: | 1 Nov 2010 19:22 | Modified: | 21 Dec 2010 18:34 |
Reporter: | Erica Moss | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Information schema | Severity: | S1 (Critical) |
Version: | 5.5.7 | OS: | Any (windows / linux) |
Assigned to: | Kevin Lewis | CPU Architecture: | Any |
Tags: | Foreign key constraint, regression |
[1 Nov 2010 19:22]
Erica Moss
[2 Nov 2010 13:42]
Kevin Lewis
The problem seems to be in ha_innobase::get_foreign_key_list(). It starts looking through a list of foreign key references but then uses the referenced keys field when looking for the next link. This is what it aught to do; for (foreign = UT_LIST_GET_FIRST(prebuilt->table->foreign_list); foreign != NULL; - foreign = UT_LIST_GET_NEXT(referenced_list, foreign)) { + foreign = UT_LIST_GET_NEXT(foreign_list, foreign)) { pf_key_info = get_foreign_key_info(thd, foreign); if (pf_key_info) { f_key_list->push_back(pf_key_info); } } So this function, which provides data for INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS, does not report more than one foreign key per table
[2 Nov 2010 15:24]
Kevin Lewis
The attached patch contains a simple testcase that now works to display both foreign keys in the same table. Pushed to mysql-5.5.7-rc-release and mysql-5.5-innodb
[2 Nov 2010 18:09]
Kevin Lewis
Pushed to Pushed to mysql-5.5.7-rc-release, mysql-5.5-innodb, mysql-trunk-innodb and mysql-next-mr-innodb
[5 Dec 2010 12:41]
Bugs System
Pushed into mysql-trunk 5.6.1 (revid:alexander.nozdrin@oracle.com-20101205122447-6x94l4fmslpbttxj) (version source revid:alexander.nozdrin@oracle.com-20101205122447-6x94l4fmslpbttxj) (merge vers: 5.6.1) (pib:23)
[14 Dec 2010 23:17]
Paul DuBois
Noted in 5.5.8 changelog. After creating a table with two foreign key constraints, the INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS table displayed only one of them.
[16 Dec 2010 22:30]
Bugs System
Pushed into mysql-5.5 5.5.9 (revid:jonathan.perkin@oracle.com-20101216101358-fyzr1epq95a3yett) (version source revid:jonathan.perkin@oracle.com-20101216101358-fyzr1epq95a3yett) (merge vers: 5.5.9) (pib:24)