[Rt-devel] Default charset for table Links : key length (in bytes)

Jérôme Fenal jfenal at gmail.com
Wed Oct 19 18:07:36 EDT 2005


Hi list,

trying to restore a rt-3.4 database on a new (MySQL) server, I
encountered a small problem : encoding and charset for table Links.

The Links table has two varchar fields, Base and Target, which are 240
_characters_ long.

I had created _manually_ the new db, using :

  create database mytest DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;

I thought setting the charset was clever. However, at restore time, I had :

  ERROR 1071 (42000): Specified key was too long; max key length is 1024 bytes

Seems that up to 4 bytes characters (with utf8) is too much as Base
and Target may result for key Links1 in (240 * 4 + 240 * 4 + 11) =
1931 bytes.
Sure it exceed InnoDB max key size. FYI, MyISAM limit is 1000 bytes,
BDB is 255 bytes.

I know that this should not be an issue as the MySQL DB is created
without asking MySQL for any charset in rt-setup-database, resulting
in a latin1 encoded database.
This is still not an issue as these two field should contain only
ASCII data (such as fsck.com-rt://example.com/ticket/1750).

But this may a problem be in the future, especially if non ASCII/Latin
users set up a Unicode RT domain name.

Therefore this mail for reference and not (yet?) a bug report.

I'll try to post a page about this on the wiki next week (backup _and_
restore for MySQL ?)

Regards,

J.
--
Jérôme Fenal - jfenal AT gmail.com - http://fenal.org/
Paris.pm - http://paris.mongueurs.net/


More information about the Rt-devel mailing list