summaryrefslogtreecommitdiff
path: root/django/core
diff options
context:
space:
mode:
authorAdrian Torres <atorresj@redhat.com>2022-11-10 19:31:31 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-12-28 12:31:04 +0100
commit7eee1dca420ee7c4451d24cd32fa08aed0dcbb36 (patch)
treef643059561e9699cc961845f63faf0a3664ff5d0 /django/core
parent78f163a4fb3937aca2e71786fbdd51a0ef39629e (diff)
Fixed #14094 -- Added support for unlimited CharField on PostgreSQL.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Diffstat (limited to 'django/core')
-rw-r--r--django/core/management/commands/inspectdb.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/django/core/management/commands/inspectdb.py b/django/core/management/commands/inspectdb.py
index 51d7866503..992c523a8e 100644
--- a/django/core/management/commands/inspectdb.py
+++ b/django/core/management/commands/inspectdb.py
@@ -339,7 +339,8 @@ class Command(BaseCommand):
# Add max_length for all CharFields.
if field_type == "CharField" and row.display_size:
- field_params["max_length"] = int(row.display_size)
+ if (size := int(row.display_size)) and size > 0:
+ field_params["max_length"] = size
if field_type in {"CharField", "TextField"} and row.collation:
field_params["db_collation"] = row.collation