On Tue, Dec 8, 2009 at 1:21 PM, germ <mitch.german...@gmail.com> wrote:
> > The point is that utf8 can use up to 3 bytes per character... > > i appreciate your reply. interesting distinction between bytes and > chars. i think i still need some more guidance. still not sure how to > resolve with your suggestion to consdier the character set. > > i am able to create the django model class defining the table manually > in mysql without any error. i was also able to create that same model > with django 1.0.2 using syncdb. however, with django 1.1.1 i get the > max_length error (as originally posted). it seems like the django > syncdb code is detecting a size threshold, outputting the error, and > exiting without ever really attempting the mysql table create. > > Yes, I believe that change was made in response to this thread: http://groups.google.com/group/django-developers/browse_thread/thread/edf3312c4fa1d2d4 reporting validation did not detect table creations that MySQL would reject. The ticket to look at for details of the change is #9431 ( http://code.djangoproject.com/ticket/9431). It appears to be rather difficult to determine ahead of time what, exactly, is the limit MySQL will apply. You show it reporting 767 bytes, that thread shows it reporting 999 bytes, the ticket notes it's a different limit for InnoDB compared to MyISAM, the table charset is a factor, etc. I think that a limit of 255 was put into Django due to difficulty (impossibility?) of figuring out ahead of time what the limit really is for the table about to be created, and since 255 would definitely not trigger an error, and probably having a unique index on a field longer than that is likely not a great idea. But I'm not sure about all the reasons, I'm just guessing based on what I read on the thread/ticket. Karen -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.