Hello, This thread is getting long. It contains lots of valid arguments. In the interest of seeking consensus, here’s a tentative summary.
Problem Typing `foo = models.CharField(max_length=100)` gets old quickly. Can we skip the `max_length` argument in many cases? Constraints Character limits and their consequences on performance vary widely across databases, which makes it impossible for Django to provide a “large enough and fast enough for everyone” default. The lowest limit mentioned in the thread is 191 on MySQL. No one talked about third-party backends; we can’t be sure that this value is compatible with unique indexing on all current backends. Making the default limit backend-dependent sounds like a bad idea, especially for pluggable applications. The implementation also looks complicated compared to the expected benefits. PostgreSQL is a bit of an outlier. As far as I understand, there’s no performance difference VARCHAR(N) and VARCHAR(). The former just validates the length of the data. The argument for not providing a default max_length is to have developers think about their data. Unfortunately, in practice, most just write `models.CharField(max_length=255)` and move one. (FWIW this limit is either a cargo-cult from the 90s <http://stackoverflow.com/a/1217518> or a micro-optimization for MySQL <http://dev.mysql.com/doc/refman/5.7/en/char.html>.) Consensus (?) In order to resolve this discussion, I think we must split it in two questions. 1) Should Django provide a reasonable default for CharField.max_length? It seems to me that the resistance to this idea weakened as the discussion unfolded. Perhaps it’s a losing fight in the long run anyway… A default value could be justified as the “reasonable length for a line of text”. Considering that the optimal line length <https://www.google.com/search?q=optimal+line+length> is around 66 characters, 100 could be a good limit. 120 would work as well. It seems more future-proof and less debatable not to tie this limit to a technical limitation of the current version of a particular database engine. On one hand, the default value matters because it will be widely used. On the other hand it doesn’t matter because developers who care about the length of their CharFields should set them explicitly. 2) How can we make it easy for PostgreSQL users to just use VARCHAR()? Since this is a PostgreSQL-specific feature, having a variant of CharField in django.contrib.postgres that supports and perhaps even defaults to unlimited length shouldn’t be controversial. I hope this helps! -- Aymeric. -- 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/A2F207B6-42EF-4E7E-80B8-6FE4C6FD8014%40polytechnique.org. For more options, visit https://groups.google.com/d/optout.