Bug #57960 InnoDB reports only 3 bytes of REFERENCED_TABLE_NAME to INFORMATION_SCHEMA
Submitted: 3 Nov 2010 19:18 Modified: 9 Dec 2010 22:36
Reporter: Kevin Lewis Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.5+ OS:Any
Assigned to: Kevin Lewis CPU Architecture:Any

[3 Nov 2010 19:18] Kevin Lewis
Description:
The new testcase for Bug#57904 shows the results of;
   select * from INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS \G;

The last field only reports 3 bytes on a 32bit OS and 6 bytes on a 64bit OS.
  REFERENCED_TABLE_NAME: cus

It aught to show the entire table name;
  REFERENCED_TABLE_NAME: customer

How to repeat:
Show the entire table name in the output of 
  select * from INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS \G;

Suggested fix:
In ha_innodb.cc, get_foreign_key_info();

	/* Referenced (parent) table name */
	ptr = dict_remove_db_name(foreign->referenced_table_name);
-	len = filename_to_tablename(ptr, name_buff, sizeof(name));
+	len = filename_to_tablename(ptr, name_buff, sizeof(name_buff));
[4 Nov 2010 7:53] Dmitry Lenev
Yet another regression caused by http://lists.mysql.com/commits/120137 fix.
[4 Nov 2010 16:26] Kevin Lewis
Patch pushed to mysql-5.5-innodb

Attachment: Bug57960.patch (application/octet-stream, text), 1.67 KiB.

[4 Nov 2010 16:28] Kevin Lewis
Patch approved by Inaam Rana on Review Board.
[4 Nov 2010 16:29] Kevin Lewis
Pushed to mysql-5.5-innodb, mysql-trunk-innodb, mysql-next-mr-innodb
[2 Dec 2010 17:03] Lawrenty Novitsky
I'm not sure if that changes anything, but the same happens with REFERENCED_TABLE_NAME in the INFORMATION_SCHEMA.KEY_COLUMN_USAGE table. I guess the patch fixes everything, but since i was about to submit a bug report, i make at least a comment, so my effort is not totally wasted...
[2 Dec 2010 17:09] Lawrenty Novitsky
ah, also on a side note - the bug is an absolute showstopper for connectors to work with 5.5.7 server. and if the patch won't make to the next release... i would call that a showstopper.
[2 Dec 2010 17:31] Kevin Lewis
This bug fixed the display of the REFERENCED_TABLE_NAME column in INFORMATION_SCHEMA.KEY_COLUMN_USAGE as well.
[9 Dec 2010 22:36] John Russell
Added to change log:

Values could be truncated in certain INFORMATION_SCHEMA columns, such
as REFERENTIAL_CONSTRAINTS.REFERENCED_TABLE_NAME and
KEY_COLUMN_USAGE.REFERENCED_TABLE_NAME.
[17 Feb 2011 14:28] Steve Moran
I can confirm that this problem has gone away in GA server v5.5.9 downloaded today 17/2/2011. Excellent.
[31 Mar 2011 21:03] MySQL Verification Team
bug #60713 is a duplicate of this.