#18392: Use utf8mb4 encoding with MySQL 5.5
-------------------------------------+-------------------------------------
     Reporter:  EmilStenstrom        |                    Owner:  nobody
         Type:  Uncategorized        |                   Status:  new
    Component:  Database layer       |                  Version:  1.4
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:  Accepted
     Keywords:                       |      Needs documentation:  0
    Has patch:  0                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by EmilStenstrom):

 Ok, there's some trickiness here. Indexes in InnoDB tables can't be longer
 than 255 chars with utf8, but only 191 chars with utf8mb4. This means that
 the default indexes that Django makes for CharField(max_length=255) is too
 long, and will break things (break what? I'm running a migration that
 converts all my tables to utf8mb4 automatically, and setting utf8mb4 on a
 long charfield breaks because the index is too long).

 From the official docs:


 {{{
 "InnoDB has a maximum index length of 767 bytes, so for utf8 or utf8mb4
 columns, you can index a maximum of 255 or 191 characters, respectively.
 If you currently have utf8 columns with indexes longer than 191
 characters, you will need to index a smaller number of characters. In an
 InnoDB table, these column and index definitions are legal:

 col1 VARCHAR(500) CHARACTER SET utf8, INDEX (col1(255))

 To use utf8mb4 instead, the index must be smaller:

 col1 VARCHAR(500) CHARACTER SET utf8mb4, INDEX (col1(191))"

 }}}

 From: http://dev.mysql.com/doc/refman/5.5/en/charset-unicode-
 upgrading.html

-- 
Ticket URL: <https://code.djangoproject.com/ticket/18392#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" 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/django-updates?hl=en.

Reply via email to