From d7e37b661c33c563a0cbca892697c62b52312223 Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Wed, 3 Sep 2008 21:10:42 +0000 Subject: [PATCH] Added a note about SQLite versions before 3.3.6. Refs #7570. Thanks, ramiro. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8950 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/ref/databases.txt | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt index e484dfd29e..d4c4a25189 100644 --- a/docs/ref/databases.txt +++ b/docs/ref/databases.txt @@ -238,6 +238,40 @@ 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.``. +.. _sqlite-notes: + + +SQLite notes +============ + +Versions of SQLite 3.3.5 and older `contain a bug`_ when handling ``ORDER BY`` +parameters. This can cause problems when you use the ``select`` parameter for +the ``extra()`` QuerySet method. The bug can be identified by the error message +``OperationalError: ORDER BY terms must not be non-integer constants``. The +problem can be solved updating SQLite to version 3.3.6 or newer, possibly also +updating the ``pysqlite2`` Python module in the process. + +.. _contain a bug: http://www.sqlite.org/cvstrac/tktview?tn=1768 + +This has a very low impact because 3.3.6 was released in April 2006, so most +current binary distributions for different platforms include newer version of +SQLite usable from Python through either the ``pysqlite2`` or the ``sqlite3`` +modules. + +However, in the case of Windows, the official binary distribution of the stable +release of Python 2.5 (2.5.2 as of now) includes SQLite 3.3.4 so the bug can +make itself evident in that platform. There are (as of Django 1.0) even three +tests in the Django test suite that will fail when run under this setup. As +described above, this can be solved by downloading and installing a newer +version of ``pysqlite2`` (``pysqlite-2.x.x.win32-py2.5.exe``) that includes and +uses a newer version of SQLite. Python 2.6 will ship with a newer version of +SQLite and so will no be affected by this issue. + +If you are in such platform and find yourself in the need to update +``pysqlite``/SQLite, you will also need to manually modify the +``django/db/backends/sqlite3/base.py`` file in the Django source tree so it +attempts to import ``pysqlite2`` before that ``sqlite3`` and so it can take +advantage of the new ``pysqlite2``/SQLite versions. .. _oracle-notes: