From 4f83bfa9e5ef10c6c9711ad529630d09a06ef413 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Thu, 27 Aug 2015 09:29:13 -0400 Subject: [PATCH] [1.8.x] Refs #2495 -- Documented that MySQL cannot have TextField(unique=True). Backport of e8cbc2b322d873a6fe39faca18d340ce93035087 from master --- docs/ref/databases.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt index 1b601234bf..227b5b7921 100644 --- a/docs/ref/databases.txt +++ b/docs/ref/databases.txt @@ -500,6 +500,14 @@ for the field. This affects :class:`~django.db.models.CharField`, :class:`~django.db.models.SlugField` and :class:`~django.db.models.CommaSeparatedIntegerField`. +``TextField`` limitations +~~~~~~~~~~~~~~~~~~~~~~~~~ + +MySQL can index only the first N chars of a ``BLOB`` or ``TEXT`` column. Since +``TextField`` doesn't have a defined length, you can't mark it as +``unique=True``. MySQL will report: "BLOB/TEXT column '' used in key +specification without a key length". + .. _mysql-fractional-seconds: Fractional seconds support for Time and DateTime fields