| 373 | |
| 374 | SQLite notes |
| 375 | ============ |
| 376 | |
| 377 | Versions of SQLite 3.3.5 and older contain a `bug`_ when handling ``ORDER BY`` |
| 378 | parameters. This can cause problems when you use the ``select`` parameter for |
| 379 | the ``extra()`` QuerySet method. The bug can be identified because a |
| 380 | ``OperationalError: ORDER BY terms must not be non-integer constants`` error |
| 381 | message is generated. The problem can be solved updating SQLite to version 3.3.6 |
| 382 | or newer, possibly also updating the ``pysqlite2`` Python module in the process. |
| 383 | |
| 384 | .. _`bug`: http://www.sqlite.org/cvstrac/tktview?tn=1768 |
| 385 | |
| 386 | This has a very low impact because 3.3.6 was released in April 2006, so most |
| 387 | current binary distributions for different platforms include newer version of |
| 388 | SQLite usable from Python through either the ``pysqlite2`` or the ``sqlite3`` |
| 389 | modules. |
| 390 | |
| 391 | But in the case of Windows, the official binary distribution of the stable |
| 392 | release of Python 2.5 (2.5.2 as of now) includes SQLite 3.3.4 so the bug can |
| 393 | make itself evident in that platform. There are (as of Django 1.0) even three |
| 394 | tests in the Django test suite that will fail when run under this setup. As |
| 395 | described above, this can be solved by downloading and installing a newer |
| 396 | version of ``pysqlite2`` (``pysqlite-2.x.x.win32-py2.5.exe``) that includes and |
| 397 | uses a newer version of SQLite. Python 2.6 will ship with a newer version of |
| 398 | SQLite and so will no be affected by this issue. |
| 399 | |
| 400 | If you are in such platform and find yourself in the need to update |
| 401 | ``pysqlite``/SQLite, you will also need to manually modify the |
| 402 | ``django/db/backends/sqlite3/base.py`` file in the Django source tree so it |
| 403 | attempts to import ``pysqlite2`` before that ``sqlite3`` and so it can take |
| 404 | advantage of the new ``pysqlite2``/SQLite versions. |