Bug #35518 Foreign keys: referenced constraint is unnamed
Submitted: 24 Mar 2008 17:24 Modified: 8 Oct 2008 15:47
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Information schema Severity:S3 (Non-critical)
Version:6.1.0-fk-debug OS:Linux (SUSE 10 | 32-bit)
Assigned to: Dmitry Lenev CPU Architecture:Any

[24 Mar 2008 17:24] Peter Gulutzan
Description:
I'm using mysql-6.1-fk.
I start mysqld with --foreign-key-all-engines=1.

In information_schema.referential_constraints,
the unique_constraint_schema column is non-blank
but the unique_constraint_name column is blank.
I think it should be 'PRIMARY'.
Look at information_schema.table_constraints
for table_name = (primary key table) and
you will see that constraint_name is 'PRIMARY'.

How to repeat:
set @@storage_engine=innodb;
create table t1 (s1 int primary key);
create table t2 (s1 int, foreign key (s1) references t1 (s1));
select unique_constraint_name
from information_schema.referential_constraints
where table_name = 't2';

The result is a blank string.
With --foreign-key-all-engines=0 and @@storage_engine=innodb,
the result would be 'PRIMARY'.
[13 Apr 2008 17:39] MySQL Verification Team
Thank you for the bug report.
[8 Oct 2008 15:38] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/55792

2684 Dmitry Lenev	2008-10-08
      Patch for the 7th milestone of WL#148 "Foreign keys"
      ("DDL checks and changes CREATE, CREATE TABLE LIKE").
      
      Implements checks and changes that should be performed by
      CREATE TABLE statement during foreign key creation and
      which are described in LLD.
      
      Adds test coverage for these checks.
      
      This patch also simplifies implementation of generic
      CREATE TABLE by removing fiddling with statement table
      list and changes foreign key handling in CREATE TABLE
      to enable code reuse.
[8 Oct 2008 15:47] Dmitry Lenev
Fix for this bug was pushed into mysql-6.1-fk tree. Since it was reported against
tree which is not publicly available yet I simply will close this bug-report.