summaryrefslogtreecommitdiff
path: root/docs/ref/databases.txt
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-12-16 06:43:18 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-12-16 06:43:18 +0000
commitb58a260c56c5d05d71ac1073bc05eda8eca0ea5f (patch)
treee5b97f4febeff7778807893e6025aced59ff7c50 /docs/ref/databases.txt
parentfddc0c589e03c1e5eb581aaa947a39720163d7d5 (diff)
Fixed #9431 -- Added extra validation for VARCHAR-based fields on MySQL.
max_length > 255 and unique=True is not permitted. Based on a patch from adamnelson. git-svn-id: http://code.djangoproject.com/svn/django/trunk@9650 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/ref/databases.txt')
-rw-r--r--docs/ref/databases.txt20
1 files changed, 18 insertions, 2 deletions
diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt
index 79e6136104..0b5a819898 100644
--- a/docs/ref/databases.txt
+++ b/docs/ref/databases.txt
@@ -234,8 +234,11 @@ storage engine, you have a couple of options.
.. _AlterModelOnSyncDB: http://code.djangoproject.com/wiki/AlterModelOnSyncDB
-Boolean fields in Django
--------------------------
+Notes on specific fields
+------------------------
+
+Boolean fields
+~~~~~~~~~~~~~~
Since MySQL doesn't have a direct ``BOOLEAN`` column type, Django uses a
``TINYINT`` column with values of ``1`` and ``0`` to store values for the
@@ -244,6 +247,19 @@ of that field for more details, but usually this won't be something that will
matter unless you're printing out the field values and are expecting to see
``True`` and ``False.``.
+Character fields
+~~~~~~~~~~~~~~~~
+
+Any fields that are stored with ``VARCHAR`` column types have their
+``max_length`` restricted to 255 characters if you are using ``unique=True``
+for the field. This affects :class:`~django.db.models.CharField`,
+:class:`~django.db.models.SlugField` and
+:class:`~django.db.models.CommaSeparatedIntegerField`.
+
+Furthermore, if you are using a version of MySQL prior to 5.0.3, all of those
+column types have a maximum length restriction of 255 characters, regardless
+of whether ``unique=True`` is specified or not.
+
.. _sqlite-notes:
SQLite notes