Bug #35522 Foreign keys: 'foreign key without name' errors
Submitted: 24 Mar 2008 18:33 Modified: 18 Apr 2008 21:10
Reporter: Peter Gulutzan
Status: Closed
Category:Server Severity:S3 (Non-critical)
Version:6.1.0-fk-debug OS:Linux (SUSE 10 | 32-bit)
Assigned to: Dmitri Lenev Target Version:6.1 (MS2)
Triage: D4 (Minor)

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

I try to create a table with a foreign key, using
syntax which is illegal in MySQL. I get the message
"Foreign key error: Constraint 'foreign key without name':
'(parent column list)' is mandatory in MySQL".
This is correct, except that there is no constraint
named 'foreign key without name'. MySQL should first
generate a name (even though the user doesn't know it),
and use the generated name in the error message.

How to repeat:
mysql> create table k10 (s1 int references x);
ERROR 1670 (42000): Foreign key error: Constraint 'foreign key without name': '(parent
column list)' is mandatory in MySQL
[24 Mar 2008 23:22] Miguel Solorzano
Thank you for the bug report.

[miguel@mirador dbs]$ 6.1fk/bin/mysql -uroot db6
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 6.1.0-fk-debug Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create table k10 (s1 int references x);
ERROR 1670 (42000): Foreign key error: Constraint 'foreign key without name': '(parent
column list)' is mandatory in MySQL
mysql>
[18 Apr 2008 13:49] 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/45599

ChangeSet@1.2606, 2008-04-18 15:49:35+04:00, dlenev@mockturtle.local +4 -0
  Fix for bug #35522 "Foreign keys: 'foreign key without name' errors".
  
  In --foreign-key-all-engines mode we should not replace names of FKs
  in error messages with 'foreign key without name' even if though names
  are automatically generated and are not known to user.
  
  Changed code to do just that.
[18 Apr 2008 21:10] Dmitri Lenev
Fix for this bug was pushed into mysql-6.1-fk tree. Since this tree is not publicly
available yet I am simply closing this bug report.