Permalink
Browse files

Documentation for 'float_is_enough' flag in Oracle OPTIONS

  • Loading branch information...
1 parent d9be2ca commit 7c8e06740a4f46b1ac4fd2b894f51b73dbcbe6be @shaib committed Sep 29, 2012
Showing with 32 additions and 0 deletions.
  1. +26 −0 docs/ref/databases.txt
  2. +6 −0 docs/releases/1.5.txt
View
26 docs/ref/databases.txt
@@ -659,6 +659,32 @@ The ``RETURNING INTO`` clause can be disabled by setting the
In this case, the Oracle backend will use a separate ``SELECT`` query to
retrieve AutoField values.
+Floats and Decimals
+-------------------
+
+The Oracle backend returns a number as a ``float``, ``int`` or
+``decimal.Decimal``, when there is enough information to know which type
+is expected. This is not the case with some expressions used in raw SQL
+(or ``extra(select={...})`` fields). In these cases, by default, the Oracle
+backend reads the value from the database as a string, and returns it as an
+``int`` or ``Decimal`` based on the presence of a decimal point in it. This
+behavior can be slow, and may cause incompatibility with other database
+backends (which use ``float`` in these cases), but it assures accurate
+number retrieval (since an Oracle ``NUMBER`` can have many more digits than
+a Python ``float``).
+
+If precision beyond ``float`` is not an issue, speed and compatibility can be
+regained by setting the ``float_is_enough`` option of the database
+configuration to True::
+
+ 'OPTIONS': {
+ 'float_is_enough': True,
+ },
+
+.. versionchanged:: 1.5
+
+The ``float_is_enough`` option is new in Django 1.5.
+
Naming issues
-------------
View
6 docs/releases/1.5.txt
@@ -129,6 +129,12 @@ Django 1.5 also includes several smaller improvements worth noting:
configuration duplication. More information can be found in the
:func:`~django.contrib.auth.decorators.login_required` documentation.
+* The Oracle backend now supports a `float_is_enough` entry in the
+ `OPTIONS` dictionary, which makes it treat numbers as floats (rather
+ than slower, more precise data types) when it does not know which
+ number type to use. For more details, see the
+ :ref:`Oracle notes <oracle-notes>`.
+
Backwards incompatible changes in 1.5
=====================================

0 comments on commit 7c8e067

Please sign in to comment.