| Bug #21432 | Database/Table name limited to 64 bytes, not chars, problems with multi-byte | ||
|---|---|---|---|
| Submitted: | 3 Aug 2006 18:31 | Modified: | 12 Apr 2007 18:11 |
| Reporter: | Andrey Hristov | ||
| Status: | Closed | ||
| Category: | Server | Severity: | S2 (Serious) |
| Version: | 4.1, 5.0, 5.1 | OS: | Any (All) |
| Assigned to: | Sergey Gluhov | Target Version: | |
| Tags: | Q1 | ||
[3 Aug 2006 21:16]
Sveta Smirnova
Verified as described using 4.1, 5.0 and 5.1 BK sources.
[15 Aug 2006 12:18]
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/10446 ChangeSet@1.2226, 2006-08-15 15:34:41+05:00, gluh@mysql.com +7 -0 Bug#20393 User name truncation in mysql client Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
[23 Aug 2006 12: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/10752 ChangeSet@1.2544, 2006-08-23 15:54:40+05:00, gluh@mysql.com +7 -0 Bug#20393 User name truncation in mysql client Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
[25 Aug 2006 20:54]
Andrey Hristov
Gluh will have some problems while merging 4.1 into 5.0 because of Alik's patch for #16899 Possible buffer overflow in handling of DEFINER-clause. Gluh, Alik's patch is again not multibyte safe so you have to rework the things for 5.0 and up.
[30 Aug 2006 12:39]
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/11066 ChangeSet@1.2548, 2006-08-30 15:56:17+05:00, gluh@mysql.com +7 -0 Bug#20393 User name truncation in mysql client Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
[30 Aug 2006 13:06]
Sergey Gluhov
Fixed in 4.1.22
[12 Sep 2006 3:17]
Paul DuBois
Noted in 4.1.22 changelog. Database and table names have a maximum length of 64 characters (even if they contain multi-byte characters), but were being truncated to64 bytes.
[18 Sep 2006 23:59]
Tim Smith
Pushed to 5.0.25 and 5.1.12
[19 Sep 2006 18:46]
Paul DuBois
Noted in 5.0.25, 5.1.12 changelogs.
[26 Sep 2006 20:29]
Michael Widenius
This patch needs to be removed from 4.1 and 5.0 becasue this may crash clients that is using NAME_LEN for static buffers. Jani has sent a suggestion to gluh for how to fix this bug in 5.1 in a manner that will have cause less problems for old and new clients
[27 Sep 2006 14:36]
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/12605 ChangeSet@1.2551, 2006-09-27 17:49:16+05:00, gluh@mysql.com +7 -0 Patch for bug#21432 is reverted
[26 Dec 2006 10:56]
Sveta Smirnova
Bug #25165 has been marked as duplicate of this one
[26 Jan 2007 13:02]
Sveta Smirnova
Bug #25832 was marked as duplicate of this one
[19 Mar 2007 13:41]
Sergey Gluhov
ChangeSet@1.2477, 2007-03-19 Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
[3 Apr 2007 16:42]
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/23684 ChangeSet@1.2553, 2007-04-03 19:40:55+05:00, gluh@mysql.com +1 -0 Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte additional fix
[4 Apr 2007 14: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/23780 ChangeSet@1.2554, 2007-04-04 17:36:58+05:00, gluh@mysql.com +2 -0 Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte additional fix(to satisfy Win where CreateFile func does not support the path longer than 260)
[9 Apr 2007 12:02]
Alexander Nozdrin
Patch for this bug also fixes BUG#21564 (SP: SHOW CREATE PROCEDURE says identifier too long, but the procedure exists).
[9 Apr 2007 14:41]
Bugs System
Pushed into 5.1.18-beta
[12 Apr 2007 18:11]
Paul DuBois
Noted in 5.1.18 changelog. Database and table names have a maximum length of 64 characters (even if they contain multi-byte characters), but were being truncated to64 bytes. The patch in 4.1.23 was reverted. I removed the 4.1.23 changelog entry. The patch in 5.0.25 was reverted in 5.0.26. I added a note about this to the 5.0.25 changelog entry.

Description: The server code uses define NAME_LEN which is 64. All around the server code NAME_LEN is used for stack allocated buffers as well as in bool check_table_name(const char *name, uint length) { const char *end= name+length; if (!length || length > NAME_LEN) return 1; ... } Because the server internally uses UTF-8 as encoding, this means that characters from cyrillic, greek and others which are represented with two bytes effectively lower the upper limit of a characters that can constitute a table name, database name too (see check_db_name()). How to repeat: -- table name which is 26 chars -> 52 bytes mysql> create table много_дълго_име_на_таблица(a int); Query OK, 0 rows affected (1.13 sec) -- table name which is 44 chars -> 88 bytes mysql> create table много_дълго_име_на_таблица_още_няколко_букви(a int); ERROR 1103 (42000): Incorrect table name 'много_дълго_име_на_таблица_още_няколко_букви' mysql> create database много_дълго_име_на_база_данни; Query OK, 1 row affected (4.25 sec) mysql> create database много_дълго_име_на_база_данни_още_малко; ERROR 1102 (42000): Incorrect database name 'много_дълго_име_на_база_данни_още_малко' Suggested fix: Change usage of NAME_LEN. Maybe introduce NAME_LEN_BYTES and separate usage of both macroses.