Ugh, I guess I'm in favor of max_length=191. It'll just be awkward to explain that one in the docs.
On Monday, December 28, 2015 at 3:27:23 PM UTC-5, Collin Anderson wrote: > > Hi All, > > I finally looked at this more today. I started working on the INDEX > (col1(191)) solution from #18392, but unfortunately I don't think we can > use that solution in this case because it's a UNIQUE index. (I still think > it's best solution for non-unique indexes.) > > I think these are our options (in my humble order of preference), none of > them ideal: > 1. Make username max_length=191 or some other nice number less 191. > 2. Revert completely back to username max_length=30 > 3. Tell mysql folks they can only use the insecure[1] version of utf8 > unless do some really complex reconfiguration (see "Hardest" solution in > the article [2]) to get utfmb4 support. Based on the fact that they're > using mysql and not PostgreSQL in the first place, many mysql users are > probably are unable to make the needed changes. > > The good news is that mysql 5.7.7 (which, will _start_ to get a lot of > real use in 16.04) changes some defaults[3] to make the "hardest" solution > easier (just need to set ROW_FORMAT=DYNAMIC). MariaDB hasn't changed the > default [4]. I hope they do before RHEL/CentOS 8. Even then it's a long > wait before most people have it. > > Collin > > [1] https://youtu.be/qFfjJ8pOrWY?t=2534 > [2] https://serversforhackers.com/mysql-utf8-and-indexing > [3] http://bugs.mysql.com/bug.php?id=68453#c430229 > [4] > https://mariadb.com/kb/en/mariadb/xtradbinnodb-server-system-variables/#innodb_large_prefix > > > > On Mon, Dec 21, 2015 at 11:32 AM, Tim Graham <timog...@gmail.com > <javascript:>> wrote: > >> I merged the often requested increase of User.username max_length to 254 >> characters [1] a few weeks ago, however, the ticket was reopened pointing >> out this issue: >> >> >> "This patch breaks on MySQL installations using the utf8mb4 charset, >> because it breaks the index length limit - it comes out at a maximum of 254 >> * 4 = 1016 bytes whilst by default InnoDB can only index 767 bytes. I found >> this because I am using utf8mb4 in django-mysql's tests. >> >> Django encourages using the utf8 charset (3 bytes per character - cannot >> store emojis), although there has been some discussion for moving to >> utf8mb4 in #18392 <https://code.djangoproject.com/ticket/18392>. One can >> index 254 character utf8mb4 fields in MySQL by using a couple settings as >> described in that ticket, Django could enforce those, or the field could be >> changed to just 191 characters instead which is the maximum indexable (767 >> // 4)." >> >> Do we have any MySQL enthusiasts willing to champion a patch (or at least >> a decision design about the best way to proceed) for #18392 [2] to resolve >> this? >> >> [1] https://code.djangoproject.com/ticket/20846 >> [2] https://code.djangoproject.com/ticket/18392 >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django developers (Contributions to Django itself)" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django-develop...@googlegroups.com <javascript:>. >> To post to this group, send email to django-d...@googlegroups.com >> <javascript:>. >> Visit this group at https://groups.google.com/group/django-developers. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-developers/ceb190b5-5218-446c-a6a0-0aea75e7fd6b%40googlegroups.com >> >> <https://groups.google.com/d/msgid/django-developers/ceb190b5-5218-446c-a6a0-0aea75e7fd6b%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/78e114b4-9595-484a-bc33-f87635a2e7c0%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.