From f452d4232e1c14269bf2f1bd234d6e4ef462dc55 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Sun, 8 Sep 2019 23:25:53 +0200 Subject: [PATCH] [2.2.x] Fixed #29823 -- Doc'd limitation of DecimalField on SQLite. Backport of b8dff52f440adfb78b40e19ee8bff45373ca2501 from master --- docs/ref/databases.txt | 12 ++++++++++++ docs/ref/models/fields.txt | 4 +++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt index 84dce9fa7c..2520e479c3 100644 --- a/docs/ref/databases.txt +++ b/docs/ref/databases.txt @@ -665,6 +665,18 @@ substring filtering. .. _documented at sqlite.org: https://www.sqlite.org/faq.html#q18 +.. _sqlite-decimal-handling: + +Decimal handling +---------------- + +SQLite has no real decimal internal type. Decimal values are internally +converted to the ``REAL`` data type (8-byte IEEE floating point number), as +explained in the `SQLite datatypes documentation`__, so they don't support +correctly-rounded decimal floating point arithmetic. + +__ https://www.sqlite.org/datatype3.html#storage_classes_and_datatypes + "Database is locked" errors --------------------------- diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt index 1090d4f66a..5ce3abae72 100644 --- a/docs/ref/models/fields.txt +++ b/docs/ref/models/fields.txt @@ -594,7 +594,9 @@ when :attr:`~django.forms.Field.localize` is ``False`` or For more information about the differences between the :class:`FloatField` and :class:`DecimalField` classes, please - see :ref:`FloatField vs. DecimalField `. + see :ref:`FloatField vs. DecimalField `. You + should also be aware of :ref:`SQLite limitations ` + of decimal fields. ``DurationField`` -----------------