Hi,

it seems there is a problem with the length of table keys, when using
MySQL 5.x and UTF8.

MySQL 5.x seems to have a maximum length 1000 bytes for a key, but it
uses three bytes (!)
for a unicode character. So the code to calculate the limit of the
keylength in mysql_backend.py
will always create keylengths that MySQL will not accept, if used with
more than one textcolumn
as keyelements.

68:        Some Versions of MySQL limit each index prefix to 500 bytes
total, with
69:        a max of 255 bytes per column.
70:        """
71:        cols = []
72:        limit = 500 / len(columns)
73:        if limit > 255:
74:            limit = 255

To stay true to KISS, change 500 in line 72 to 333 should do the
trick. At least this patch
worked for us.

-- Max

Patch:
Index: mysql_backend.py
===================================================================
--- mysql_backend.py    (Revision 4635)
+++ mysql_backend.py    (Arbeitskopie)
@@ -67,9 +67,11 @@

         Some Versions of MySQL limit each index prefix to 500 bytes
total, with
         a max of 255 bytes per column.
+        MySQL5 limits keylengths to 1000 bytes total, using 3 bytes
per unicode
+        character, thus 1000 / 3 = 333.
         """
         cols = []
-        limit = 500 / len(columns)
+        limit = 333 / len(columns)
         if limit > 255:
             limit = 255
         for c in columns:


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/trac-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to