﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
36886	URLField max_length cannot take advantage of supports_unlimited_charfield in DB backend	Joel D Sleppy	Joel D Sleppy	"When using a DB backend that `supports_unlimited_charfield` (postgres, sqlite), a `CharField` can omit `max_length` and allow arbitrarily long values in the database.  However `URLField`, which inherits from `CharField`, forces the developer to pick a maximum length.  For example, this model class:

{{{#!python
class Thing(models.Model):
    chars = models.CharField()
    url = models.URLField()
}}}

Creates this table in postgres:

{{{
                                 Table ""public.app_thing""
 Column |          Type          | Collation | Nullable |             Default              
--------+------------------------+-----------+----------+----------------------------------
 id     | bigint                 |           | not null | generated by default as identity
 chars  | character varying      |           | not null | 
 url    | character varying(200) |           | not null | 
}}}

And trying to set `url = models.URLField(max_length=None)` does not get recognized as a change by `makemigrations`.

URLs can get quite long and it's an inconvenience to pick a maximum length (and to defensively code against the possibility of it being violated).  I'd like to work on this improvement myself if there's any appetite for it.

Possible changes:

- For backwards compatibility, continue to default `max_length` to `200` but allow specifying `None` to have an unbounded field.
- Break backwards compatibility, changing behavior to match that of `CharField`."	New feature	closed	Database layer (models, ORM)	6.0	Normal	wontfix			Unreviewed	0	1	1	0	0	0
