Commit Graph

250 Commits

Author SHA1 Message Date
Claude Paroz 8ee1eddb7e Add a BinaryField model field
Thanks Michael Jung, Charl Botha and Florian Apolloner for review
and help on the patch.
2013-03-02 10:29:02 +01:00
Aymeric Augustin 2ee21d9f0d Implemented persistent database connections.
Thanks Anssi Kääriäinen and Karen Tracey for their inputs.
2013-02-28 15:28:13 +01:00
Aymeric Augustin 59a3520875 Refactored database exceptions wrapping.
Squashed commit of the following:

commit 2181d833ed1a2e422494738dcef311164c4e097e
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Wed Feb 27 14:28:39 2013 +0100

    Fixed #15901 -- Wrapped all PEP-249 exceptions.

commit 5476a5d93c19aa2f928c497d39ce6e33f52694e2
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Tue Feb 26 17:26:52 2013 +0100

    Added PEP 3134 exception chaining.

    Thanks Jacob Kaplan-Moss for the suggestion.

commit 9365fad0a650328002fb424457d675a273c95802
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Tue Feb 26 17:13:49 2013 +0100

    Improved API for wrapping database errors.

    Thanks Alex Gaynor for the proposal.

commit 1b463b765f2826f73a8d9266795cd5da4f8d5e9e
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Tue Feb 26 15:00:39 2013 +0100

    Removed redundant exception wrapping.

    This is now taken care of by the cursor wrapper.

commit 524bc7345a724bf526bdd2dd1bcf5ede67d6bb5c
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Tue Feb 26 14:55:10 2013 +0100

    Wrapped database exceptions in the base backend.

    This covers the most common PEP-249 APIs:
    - Connection APIs: close(), commit(), rollback(), cursor()
    - Cursor APIs: callproc(), close(), execute(), executemany(),
      fetchone(), fetchmany(), fetchall(), nextset().

    Fixed #19920.

commit a66746bb5f0839f35543222787fce3b6a0d0a3ea
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Tue Feb 26 14:53:34 2013 +0100

    Added a wrap_database_exception context manager and decorator.

    It re-throws backend-specific exceptions using Django's common wrappers.
2013-02-27 17:26:54 +01:00
Anssi Kääriäinen 50328f0a61 Fixed #19861 -- Transaction ._dirty flag improvement
There were a couple of errors in ._dirty flag handling:
  * It started as None, but was never reset to None.
  * The _dirty flag was sometimes used to indicate if the connection
    was inside transaction management, but this was not done
    consistently. This also meant the flag had three separate values.
  * The None value had a special meaning, causing for example inability
    to commit() on new connection unless enter/leave tx management was
    done.
  * The _dirty was tracking "connection in transaction" state, but only
    in managed transactions.
  * Some tests never reset the transaction state of the used connection.
  * And some additional less important changes.

This commit has some potential for regressions, but as the above list
shows, the current situation isn't perfect either.
2013-02-27 17:54:27 +02:00
Aymeric Augustin ebabd77291 Ensured a connection is established when checking the database version.
Fixed a test broken by 21765c0a. Refs #18135.
2013-02-19 10:51:24 +01:00
Aymeric Augustin 21765c0a6c Implemented PostgreSQL version as a cached property. 2013-02-18 22:49:59 +01:00
Aymeric Augustin 29628e0b6e Factored out common code in database backends. 2013-02-18 17:19:09 +01:00
Aymeric Augustin e74e207cce Fixed #17260 -- Added time zone aware aggregation and lookups.
Thanks Carl Meyer for the review.

Squashed commit of the following:

commit 4f290bdb60
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Wed Feb 13 21:21:30 2013 +0100

    Used '0:00' instead of 'UTC' which doesn't always exist in Oracle.

    Thanks Ian Kelly for the suggestion.

commit 01b6366f3c
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Wed Feb 13 13:38:43 2013 +0100

    Made tzname a parameter of datetime_extract/trunc_sql.

    This is required to work around a bug in Oracle.

commit 924a144ef8
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Wed Feb 13 14:47:44 2013 +0100

    Added support for parameters in SELECT clauses.

commit b4351d2890
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Feb 11 22:30:22 2013 +0100

    Documented backwards incompatibilities in the two previous commits.

commit 91ef84713c
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Feb 11 09:42:31 2013 +0100

    Used QuerySet.datetimes for the admin's date_hierarchy.

commit 0d0de288a5
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Feb 11 09:29:38 2013 +0100

    Used QuerySet.datetimes in date-based generic views.

commit 9c0859ff7c
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Feb 10 21:43:25 2013 +0100

    Implemented QuerySet.datetimes on Oracle.

commit 68ab511a4f
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Feb 10 21:43:14 2013 +0100

    Implemented QuerySet.datetimes on MySQL.

commit 22d52681d3
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Feb 10 21:42:29 2013 +0100

    Implemented QuerySet.datetimes on SQLite.

commit f6800fd04c
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Feb 10 21:43:03 2013 +0100

    Implemented QuerySet.datetimes on PostgreSQL.

commit 0c829c23f4
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Feb 10 21:41:08 2013 +0100

    Added datetime-handling infrastructure in the ORM layers.

commit 104d82a777
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Feb 11 10:05:55 2013 +0100

    Updated null_queries tests to avoid clashing with the __second lookup.

commit c01bbb3235
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Feb 10 23:07:41 2013 +0100

    Updated tests of .dates().

    Replaced .dates() by .datetimes() for DateTimeFields.
    Replaced dates with datetimes in the expected output for DateFields.

commit 50fb7a5246
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Feb 10 21:40:09 2013 +0100

    Updated and added tests for QuerySet.datetimes.

commit a8451a5004
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Feb 10 22:34:46 2013 +0100

    Documented the new time lookups and updated the date lookups.

commit 29413eab2b
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Feb 10 16:15:49 2013 +0100

    Documented QuerySet.datetimes and updated QuerySet.dates.
2013-02-16 09:19:04 +01:00
Anssi Kääriäinen 0478780b8e Fixed #19638 -- Skipped tx support testing for some DBs
PostgreSQL and Oracle always support transactions, so the create table
and rollback test is non-necessary on those DBs.

Thanks to shai for report.
2013-02-10 18:56:36 +02:00
Claude Paroz 0171ba65db Fixed #17574 -- Implemented missing get_key_columns in PostgreSQL backend 2013-01-12 21:46:08 +01:00
Claude Paroz 223fc8eaf9 Return namedtuple from get_table_description
We don't make use of it currently to not break third-party db
backends.
2013-01-12 21:14:22 +01:00
Claude Paroz c698c55966 Created special PostgreSQL text indexes when unique is True
Refs #19441.
2013-01-07 17:54:30 +01:00
Andrew Godwin b62e82365a Merge remote-tracking branch 'core/master' into schema-alteration
Conflicts:
	django/db/models/loading.py
	django/db/models/options.py
2012-12-18 09:02:07 +00:00
Claude Paroz 55972ee5c7 Fixed #19441 -- Created PostgreSQL varchar index when unique=True
Thanks Dylan Verheul for the report and Anssi Kääriäinen for the
review.
2012-12-18 09:56:30 +01:00
Anssi Kääriäinen 1893467784 Fixed #19274 -- Made db connection creation overridable in subclasses
Connection creation was done in db backend ._cursor() call. This
included taking a new connection if needed, initializing the session
state for the new connection and finally creating the connection.

To allow easier modifying of these steps in subclasses (for example to
support connection pools) the _cursor() now calls get_new_connection()
and init_connection_state() if there isn't an existing connection. This
was done for all non-gis core backends. In addition the parameters used
for taking a connection are now created by get_connection_params().

We should also do the same for gis backends and encourage 3rd party
backends to use the same pattern. The pattern is not enforced in code,
and as the backends are private API this will not be required by
documentation either.
2012-11-27 19:47:19 +02:00
Andrew Godwin 6a632e0457 Merge branch 'master' into schema-alteration
Conflicts:
	django/db/backends/__init__.py
	django/db/models/fields/related.py
	django/db/models/options.py
2012-10-26 08:41:13 +01:00
Claude Paroz 26ff2be787 Imported getLogger directly from logging module
This was a remainder of some 2.4 compatibility code.
2012-09-20 21:03:24 +02:00
Andrew Godwin c5e2ecae69 Fix bug in get_indexes affecting the tests 2012-09-17 23:45:00 +01:00
Andrew Godwin 9313dea700 Merge remote-tracking branch 'core/master' into schema-alteration
Conflicts:
	django/db/backends/mysql/base.py
	django/db/backends/postgresql_psycopg2/base.py
2012-09-17 20:00:14 +01:00
Claude Paroz 859aa2a6c4 Fixed #18790 -- Encoded database password on Python 2
Thanks thcourbon@gmail.com for the report.
2012-09-12 10:16:49 +02:00
Andrew Godwin ca9c3cd39f Add check constraint support - needed a few Field changes 2012-09-07 15:40:59 -04:00
Andrew Godwin a92bae0f06 Repoint ForeignKeys when their to= changes. 2012-09-07 13:31:05 -04:00
Andrew Godwin b546e7eb63 Merge branch 'master' into schema-alteration 2012-09-05 09:39:03 -04:00
Andrew Godwin d865503389 db_index alteration mostly working 2012-08-30 23:11:56 +01:00
Claude Paroz a9a773ff38 Made get_table_description also return the size of char fields on SQLite 2012-08-30 19:36:05 +02:00
Aymeric Augustin 547b181046 [py3] Ported django.utils.safestring.
Backwards compatibility aliases were created under Python 2.
2012-08-18 16:04:06 +02:00
Andrew Godwin cab044c66c First stab at MySQL support 2012-08-18 12:29:31 +01:00
Andrew Godwin b139315f1c Add M2M tests and some unique support 2012-08-02 15:08:39 +01:00
Andrew Godwin 4a2e80fff4 Merge branch 'master' of github.com:django/django into schema-alteration
Conflicts:
	django/db/backends/postgresql_psycopg2/base.py
2012-07-26 18:58:10 +01:00
Ramiro Morales f758bdab5e Fixed #18271 -- Changed stage at which TransactionTestCase flushes DB tables.
Previously, the flush was done before the test case execution and now
it is performed after it.

Other changes to the testing infrastructure include:

* TransactionTestCase now doesn't reset autoincrement sequences either
  (previous behavior can achieved by using `reset_sequences`.)
  With this, no implicit such reset is performed by any of the provided
  TestCase classes.

* New ordering of test cases: All unittest tes cases are run first and
  doctests are run at the end.

THse changes could be backward-incompatible with test cases that relied
on some kind of state being preserved between tests. Please read the
relevant sections of the release notes and testing documentation for
further details.

Thanks Andreas Pelme for the initial patch. Karen Tracey and Anssi
Kääriäinen for the feedback and Anssi for reviewing.

This also fixes #12408.
2012-07-24 17:24:16 -03:00
Aymeric Augustin 7fa51a24a8 [py3] Exception aren't iterable in Python 3. 2012-07-22 09:29:52 +02:00
Aymeric Augustin d796c94b03 [py3] Used six.reraise wherever necessary. 2012-07-22 09:29:52 +02:00
Claude Paroz 828f7b62e8 Fixed #18602 -- Improved error message when database NAME is missing
Thanks Kristian Glass for the report.
2012-07-10 13:22:55 +02:00
Andrew Godwin 959a3f9791 Add some field schema alteration methods and tests. 2012-06-19 13:25:22 +01:00
Andrew Godwin 8ba5bf3198 Very start of schema alteration port. Create/delete model and some tests. 2012-06-18 17:34:36 +01:00
Claude Paroz e9ef9776d1 Fixed #18461 -- Ensured that last_executed_query returns Unicode
Thanks Anssi Kääriäinen for the review.
2012-06-13 12:04:46 +02:00
Claude Paroz 4a103086d5 Fixed #18269 -- Applied unicode_literals for Python 3 compatibility.
Thanks Vinay Sajip for the support of his django3 branch and
Jannis Leidel for the review.
2012-06-07 18:08:47 +02:00
Anssi Kääriäinen a18e43c5bb Made get_indexes() consistent across backends.
Fixed #15933, #18082 -- the get_indexes() method introspection was
done inconsitently depending on the backend. For example SQLite
included all the columns in the table in the returned dictionary,
while MySQL introspected also multicolumn indexes.

All backends return now consistenly only single-column indexes.

Thanks to andi for the MySQL report, and ikelly for comments on
Oracle's get_indexes() changes.
2012-04-30 14:30:29 +03:00
Claude Paroz 3904b74a3f Fixed #18013 -- Use the new 'as' syntax for exceptions.
Thanks Clueless for the initial patch.
Note that unittest has been purposely left out (external package only used by Python 2.6).
2012-04-29 20:57:15 +02:00
Aymeric Augustin 3ef55dfaa0 Fixed #17882 (again) -- Updated the database connections' time zone when time-zone-related settings are changed in tests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17709 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-03-13 23:29:15 +00:00
Ramiro Morales 328c70ef15 Fixed #10837 -- Added CHAR(X)->CharField to mapping used in Postgres DB introspection.
Thanks trbs for the report and initial patch and to Claude Paroz for
updating it.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17511 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-02-11 22:17:02 +00:00
Ramiro Morales ccc0e122d4 Fixed #7783 -- Made introspection of nullable columns more robust with Postgres.
Thanks bthomas AT ncorcle DOT com for the report and initial patch, and
Claude Paroz for the final, complete patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17508 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-02-11 20:05:50 +00:00
Ramiro Morales 287565779d Added support for modifying the effect of ``DISTINCT`` clauses so they
only consider some fields (PostgreSQL only).

For this, the ``distinct()`` QuerySet method now accepts an optional
list of model fields names and generates ``DISTINCT ON`` clauses on
these cases. Thanks Jeffrey Gelens and Anssi Kääriäinen for their work.

Fixes #6422.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17244 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-22 20:42:40 +00:00
Julien Phalip a1d2f1f7b7 Ensured that thread-shareability gets validated when closing a PostgreSQL or SQLite connection. Refs #17258.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17206 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-16 17:02:41 +00:00
Aymeric Augustin 219b41cc15 Fixed #17266 -- Skipped the "SET TIME ZONE" query for PostgreSQL when it isn't necessary.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17194 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-11 08:19:04 +00:00
Aymeric Augustin 74b836abf5 Fixed #17062 -- Ensured that the effect of SET TIME ZONE isn't lost when the first transation is rolled back under PostgreSQL. Thanks Anssi for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17128 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-11-20 16:12:33 +00:00
Aymeric Augustin 549c495875 Used symbolic constants for psycopg2 isolation levels.
Django used the value 1 = ISOLATION_LEVEL_READ_UNCOMMITTED in some places, but
PostgreSQL doesn't provide "read uncommited", it uses "read committed" instead:
http://www.postgresql.org/docs/9.1/static/transaction-iso.html. For clarity,
this commit uses ISOLATION_LEVEL_READ_COMMITTED = 2 where 1 was previously used.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@17112 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-11-19 14:18:44 +00:00
Aymeric Augustin 9b1cb755a2 Added support for time zones. Thanks Luke Plant for the review. Fixed #2626.
For more information on this project, see this thread:
http://groups.google.com/group/django-developers/browse_thread/thread/cf0423bbb85b1bbf



git-svn-id: http://code.djangoproject.com/svn/django/trunk@17106 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-11-18 13:01:06 +00:00
Aymeric Augustin 246580573d Fixed #12308 -- Added tablespace support to the PostgreSQL backend.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16987 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-14 21:49:43 +00:00
Alex Gaynor 7deb25b8dd Fixed #7596. Added Model.objects.bulk_create, and make use of it in several places. This provides a performance benefit when inserting multiple objects. THanks to Russ for the review, and Simon Meers for the MySQl implementation.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16739 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-09 19:22:28 +00:00
Honza Král 93f92635b6 Follow the same convention as the rest of the file.
Still cleanup after [16708]

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16710 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-08-29 23:01:25 +00:00
Honza Král 0037ca44d6 Forgotten import in [16708]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16709 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-08-29 17:28:15 +00:00
Honza Král 7c657b2416 Fixed #15802 -- pyscopg2 sometimes fail to close the connection when it's already closed by the server, Thanks Rick van Hattem
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16708 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-08-29 15:55:06 +00:00
Karen Tracey be87f0b0ec Fixed #3615: Added support for loading fixtures with forward references on database backends (such as MySQL/InnoDB) that do not support deferred constraint checking. Many thanks to jsdalton for coming up with a clever solution to this long-standing issue, and to jacob, ramiro, graham_king, and russellm for review/testing. (Apologies if I missed anyone else who helped here.)
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16590 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-08-07 00:43:26 +00:00
Jannis Leidel 24f4764a48 Fixed #16225 -- Removed unused imports. Many thanks to Aymeric Augustin for the work on the patch and Alex for reviewing.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16539 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-07-13 09:35:51 +00:00
Ramiro Morales 569aa34ea5 Fixed #16250 -- Made test database creation support code in the PostgreSQL DB backend compatible with psycopg2 2.4.2.
Implemented this by adding an internal hook for work that should be performed
before that point.

Also, regarding the `DatabaseCreation.set_autocommit()` method:
 * Stop using it for such tasks
 * Stop providing an implementation that tries to cover all the possible
   idioms a third party database backend DB-API 2 driver could need to activate
   autocommit. It is now left for third party backends to implement.

This can be backwards incompatible in the case of user applications that:
 * Had started using this method
 * Use a third a party database backend

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16520 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-07-06 23:25:30 +00:00
Ramiro Morales 9eb2afddfa Removed more code for handling of PostgreSQL versions older than 8.2; use always "INSERT... RETURNING..." rather than "INSERT...; SELECT CURRVAL...". Thanks Christoph Pettus for the report and hints. Fixes #12180. Refs [16423].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16443 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-19 19:54:20 +00:00
Ramiro Morales f2dca72afd Fixed #11065, #11285 -- Streamlined PostgreSQL version detection, fixing incompatibility with multi-db. Thanks findepi for the report.
Changed our internal representation of the PostgreSQL version from tuples to
integers as used by libpq and psycopg2. This simplifies version comparison
operations.

Also, using the associated libpq/psycopg2 API allows to remove the need for
manually issuing in-band ``SELECT version()`` SQL queries to obtain the server
version (or at least reduce its number if version of psycopg2 in use is older
than 2.0.12). Refs #10509.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16439 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-19 18:00:09 +00:00
Ramiro Morales b870bf6b9a Fixed #16255 -- Raised minimum PostgreSQL version supported to 8.2.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16423 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-16 20:05:25 +00:00
Jannis Leidel 479f2bce3c Removed duplicate entry in introspection PostgreSQL db backend.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16394 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-13 20:15:04 +00:00
Jannis Leidel ce3c281090 Fixed #811 -- Added support for IPv6 to forms and model fields. Many thanks to Erik Romijn.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16366 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-11 13:48:24 +00:00
Jacob Kaplan-Moss 5b0e4e49d4 Fixed #14091 - be more correct about logging queries in connection.queries.
Thanks to Aymeric Augustin for figuring out how to make this work across
multiple databases.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16081 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-04-22 12:14:54 +00:00
Jacob Kaplan-Moss 8f0f73c7b8 Fixed #2705: added a `select_for_update()` clause to querysets.
A number of people worked on this patch over the years -- Hawkeye, Colin Grady,
KBS, sakyamuni, anih, jdemoor, and Issak Kelly. Thanks to them all, and
apologies if I missed anyone.

Special thanks to Dan Fairs for picking it up again at the end and seeing this
through to commit.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16058 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-04-20 20:42:07 +00:00
Ramiro Morales 30b3d51599 Fixed #13630 -- Made __init__ methods of all DB backends' DatabaseOperations classes take a `connection` argument. Thanks calexium for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16016 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-04-05 00:19:17 +00:00
Russell Keith-Magee 8911754555 Deprecated the psycopg-based postgresql database backend.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15980 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-04-02 08:39:08 +00:00
Carl Meyer 616b30227d Fixed #7539, #13067 -- Added on_delete argument to ForeignKey to control cascade behavior. Also refactored deletion for efficiency and code clarity. Many thanks to Johannes Dollinger and Michael Glassford for extensive work on the patch, and to Alex Gaynor, Russell Keith-Magee, and Jacob Kaplan-Moss for review.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14507 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-09 16:46:42 +00:00
Ramiro Morales cfdad9ed86 Fixed #14223 -- Extended unification of exception raised in presence of integrity constraint violations.
The unification had been introduced in r12352 and native backend exceptions still
slipped through in cases that end in connection.commit() call. Thanks Alex,
Jacob and Carl for reviewing.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14320 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-23 00:01:22 +00:00
Russell Keith-Magee 121d2e3678 Fixed #12991 -- Added unittest2 support. Thanks to PaulM for the draft patch, and to Luke, Karen, Justin, Alex, Łukasz Rekucki, and Chuck Harmston for their help testing and reviewing the final patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14139 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-11 12:55:17 +00:00
Russell Keith-Magee 6909c22663 Fixed #13798 -- Added connection argument to the connection_created signal. Thanks to liangent for the report, and Alex Gaynor for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13672 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-08-30 13:21:18 +00:00
Russell Keith-Magee 5670331343 Corrected an edge case introduced in r12602. Thanks to Ramiro Morales for the eagle eyes.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12605 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-26 16:11:25 +00:00
Russell Keith-Magee 46cc7021a8 Fixed #1480 -- Added the ability to use the system timezone. Thanks to Ramiro Morales for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12602 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-26 15:33:27 +00:00
Russell Keith-Magee 11ee9746a0 Fixed #12702 -- Introduced a common implementation of DatabaseError and IntegrityError, so that database backends can (re)raise common error classes. Thanks for Waldemar Kornewald for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12352 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-29 15:45:55 +00:00
Russell Keith-Magee ff60c5f9de Fixed #1142 -- Added multiple database support.
This monster of a patch is the result of Alex Gaynor's 2009 Google Summer of Code project.
Congratulations to Alex for a job well done.

Big thanks also go to:
 * Justin Bronn for keeping GIS in line with the changes,
 * Karen Tracey and Jani Tiainen for their help testing Oracle support
 * Brett Hoerner, Jon Loyens, and Craig Kimmerer for their feedback.
 * Malcolm Treddinick for his guidance during the GSoC submission process.
 * Simon Willison for driving the original design process
 * Cal Henderson for complaining about ponies he wanted.

... and everyone else too numerous to mention that helped to bring this feature into fruition.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11952 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-22 15:18:51 +00:00
Russell Keith-Magee 756d6f3a24 More fixes to PostgreSQL version comparisons from r10730.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10740 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-11 11:56:46 +00:00
Russell Keith-Magee b97178f7ec Fixed #10842 -- Corrected parsing of version numbers for PostgreSQL 8.4beta series. Thanks to hgdeoro for the report and fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10730 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-10 09:22:06 +00:00
Russell Keith-Magee f824ecc363 Fixed #10958 -- Corrected the setting of PostgreSQL isolation level. Thanks to kmishler for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10728 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-10 06:23:29 +00:00
Justin Bronn da3b38cdda Fixed #6064 -- Added the `connection_created` signal for when a database connection is created.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10182 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-29 23:15:58 +00:00
Malcolm Tredinnick 536ccd1134 More fixing of PostgreSQL < 8.2 problems with the psycopg2 backend.
Affects the postgresql_psycopg2 backend only. We now don't use the
"RETURNING" syntax in SQL INSERT statements unless it's required by the
autocommit behaviour. This fixes an edge-case that could cause crashes
with earlier PostgreSQL versions, but the broader problem remains to be
fixed (which is #10509).

Fixed #10467. Refs #10509.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10065 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-16 00:34:58 +00:00
Ian Kelly c3dc837950 Fixed #10473: Added Oracle support for "RETURNING" ids from insert statements.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10044 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-12 23:41:27 +00:00
Malcolm Tredinnick a152909069 Fixed #10467 -- Fixed generated INSERT SQL for PostgreSQL 8.1 and earlier.
I introduced a bad regression in r10029, forgetting to check that some
syntax was supported. For now, you can't use autocommit=True with 8.1
and earlier (it's still available for later versions). I'll fix the
broader issue later and re-enable it for those versions, but I want to
get the SQL regression for the default path out of the code right now.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10035 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-12 05:32:00 +00:00
Malcolm Tredinnick d4677d4bfb Slight refactoring of isolation setting from r10029.
There was a bug in the way we were reading the DATABASE_OPTIONS setting
and a lot of essentially duplicated code. This is neater.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10033 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-12 05:30:51 +00:00
Malcolm Tredinnick 5fb6667036 Fixed #3460 -- Added an ability to enable true autocommit for psycopg2 backend.
Ensure to read the documentation before blindly enabling this: requires some
code audits first, but might well be worth it for busy sites.

Thanks to nicferrier, iamseb and Richard Davies for help with this patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10029 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-11 07:06:50 +00:00
Adrian Holovaty 315145f7ca Fixed #10459 -- Refactored the internals of database connection objects so that connections know their own settings and pass around settings as dictionaries instead of passing around the Django settings module itself. This will make it easier for multiple database support. Thanks to Alex Gaynor for the initial patch.
This is backwards-compatible but will likely break third-party database backends. Specific API changes are:

* BaseDatabaseWrapper.__init__() now takes a settings_dict instead of a settings module. It's called settings_dict to disambiguate, and for easy grepability. This should be a dictionary containing DATABASE_NAME, etc.

* BaseDatabaseWrapper has a settings_dict attribute instead of an options attribute. BaseDatabaseWrapper.options is now BaseDatabaseWrapper['DATABASE_OPTIONS']

* BaseDatabaseWrapper._cursor() no longer takes a settings argument.

* BaseDatabaseClient.__init__() now takes a connection argument (a DatabaseWrapper instance) instead of no arguments.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@10026 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-11 03:39:34 +00:00
Malcolm Tredinnick b5d4a8ae1b Fixed #6710 -- Made DATABASE_OPTIONS work with postgresql_psycopg2 backend.
Thanks to rcoup for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9981 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-06 02:36:56 +00:00
Malcolm Tredinnick 21672c26bf Fixed #8592 -- Fixed a bug in the way savepoint usage was disabled for
PostgreSQL < 8.0.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8648 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-28 06:49:00 +00:00
Jacob Kaplan-Moss 3df7266056 Fixed #3575: use UPPER() instead ILIKE for postgres case-insensitive comparisons.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8536 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-25 12:56:06 +00:00
Malcolm Tredinnick 29d2160213 Fixed #7464 -- Fixed the psycopg2 backend to handle SafeString values as
parameters. Based on a patch from Digitalxero@gmail.com.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8532 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-25 04:13:27 +00:00
Malcolm Tredinnick 6bebb23318 Do not use savepoints with PostgreSQL prior to 8.0.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8317 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-12 06:31:29 +00:00
Malcolm Tredinnick 220993bcc5 Added savepoint support to the transaction code.
This is a no-op for most databases. Only necessary on PostgreSQL so that we can
do things which will possibly intentionally raise an IntegrityError and not
have to rollback the entire transaction. Not supported for PostgreSQL versions
prior to 8.0, so should be used sparingly in internal Django code.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8314 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-12 05:34:56 +00:00
Russell Keith-Magee 97fd752fe7 Removed some empty modules that are no longer required after [8296].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8301 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-11 14:16:09 +00:00
Russell Keith-Magee 9dc4ba875f Fixed #5461 -- Refactored the database backend code to use classes for the creation and introspection modules. Introduces a new validation module for DB-specific validation. This is a backwards incompatible change; see the wiki for details.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8296 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-11 12:11:25 +00:00
Malcolm Tredinnick 348f2cbfc1 Fixed #5996 -- Add a pyscopg2 convertor for SafeUnicode -> unicode. Thanks, remco@diji.biz
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6816 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-01 22:26:24 +00:00
Adrian Holovaty c599de2ac6 Added a BaseDatabaseOperations.last_executed_query() hook, which allows a database backend to specify how to get the last-executed query on a given cursor. Implemented it for the psycopg2 backend. This means that for psycopg2, the SQL statements in django.db.connection.queries will now reflect the exact SQL as sent to the server, instead of a naive and misleading string-interpolated version
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6601 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-23 19:00:31 +00:00
Malcolm Tredinnick 134bf3a26b Backed out [6165]. It breaks things for people using psycopg2 because it requires psycopg to also be installed due to imports.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6171 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 06:21:25 +00:00
Gary Wilson Jr 30b24a6cce Refs #4299 -- Removed some code duplication in the postgresql introspection modules by letting the `postgresql_psycopg2` backend use identical functions from the `postgresql` backend.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6165 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 05:33:39 +00:00
Adrian Holovaty 8b8a36c7d0 Changed postgresql and postgresql_psycopg2 backends NOT to do a SELECT version() for every connection, which was ludicrous. Now the version is only retrieved if it needs to be, via a lazy loader.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6012 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-25 19:24:47 +00:00
Adrian Holovaty b367ec2244 Made various negligible formatting cleanups to the database backends
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5983 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 03:32:06 +00:00
Adrian Holovaty 14db37319b Refactored OPERATOR_MAPPING so that it exists as django.db.connection.operators instead of django.db.backend.OPERATOR_MAPPING. Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5982 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 03:26:55 +00:00
Adrian Holovaty 1a8f9b2b97 Implemented BaseDatabaseFeatures and changed all code to access it -- connection.features.foo instead of backend.foo
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5974 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 02:20:33 +00:00
Adrian Holovaty 4f82250512 Removed unneeded import from postgresql_psycopg2/base.py
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5973 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 01:30:11 +00:00
Adrian Holovaty f4b397087c Moved postgresql backend DatabaseOperations class into a new module, postgresql/operations.py, so that it can be imported by both the postgresql and postgresql_psycopg2 backends. Hence the two backends no longer have a duplicated DatabaseOperations class
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5972 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 01:26:46 +00:00
Adrian Holovaty a6a5e3cf32 Removed backend.dictfetchall(), as it wasn't being used anywhere
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5970 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 01:14:53 +00:00
Adrian Holovaty ba49e7be08 Removed backend.dictfetchmany(), as it wasn't being used anywhere
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5969 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 01:14:03 +00:00
Adrian Holovaty 1b4cfd4fea Removed backend.dictfetchone(), as it wasn't being used anywhere
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5968 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 01:13:12 +00:00
Adrian Holovaty 221f99ed58 Refactored quote_name() to DatabaseOperations.quote_name(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5967 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 01:03:33 +00:00
Adrian Holovaty 13061bf20b Refactored get_start_transaction_sql() to DatabaseOperations.start_transaction_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5965 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 00:24:03 +00:00
Adrian Holovaty 147e99a08a Refactored get_sql_sequence_reset() to DatabaseOperations.sequence_reset_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5964 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 00:21:10 +00:00
Adrian Holovaty aaed6e04ec Refactored get_sql_flush() to DatabaseOperations.sql_flush(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5963 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 00:15:53 +00:00
Adrian Holovaty c44fb66551 Refactored get_random_function_sql() to DatabaseOperations.random_function_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5962 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 00:04:20 +00:00
Adrian Holovaty aaf8760227 Refactored get_pk_default_value() to DatabaseOperations.pk_default_value(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5961 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 23:59:06 +00:00
Adrian Holovaty e4b7e369dd Refactored get_max_name_length() to DatabaseOperations.max_name_length(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5960 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 23:53:39 +00:00
Adrian Holovaty d3e69c3a47 Refactored get_limit_offset_sql() to DatabaseOperations.limit_offset_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5959 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 23:24:59 +00:00
Adrian Holovaty 5ce050a5f5 Refactored get_last_insert_id() to DatabaseOperations.last_insert_id(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5958 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 23:18:43 +00:00
Adrian Holovaty 5a6426448f Refactored get_fulltext_search_sql() to DatabaseOperations.fulltext_search_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5957 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 23:13:06 +00:00
Adrian Holovaty 23a736dca9 Refactored get_drop_foreignkey_sql() to DatabaseOperations.drop_foreignkey_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5956 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 23:07:34 +00:00
Adrian Holovaty 8e84d35d38 Refactored get_deferrable_sql() to DatabaseOperations.deferrable_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5955 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 23:03:38 +00:00
Adrian Holovaty 29f67dce9e Refactored get_datetime_cast_sql() to DatabaseOperations.datetime_cast_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5953 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 22:55:05 +00:00
Adrian Holovaty 5f51f0524a Refactored get_date_trunc_sql() to DatabaseOperations.date_trunc_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5952 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 22:47:43 +00:00
Adrian Holovaty aab04a4c2f Refactored get_date_extract_sql() to DatabaseOperations.date_extract_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5951 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 22:40:06 +00:00
Adrian Holovaty 38b5d7f23d Began implementing BaseDatabaseOperations class for every database backend. This class will be used to hold the database-specific methods that currently live at the module level in each backend. Only autoinc_sql() has been implemented so far.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5950 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 22:29:57 +00:00
Adrian Holovaty 7c41b19c8a Refactored all database backends to inherit from a common base class to remove quite a bit of duplicated code. Thanks for the patch, Brian Harring. Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5949 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 21:30:57 +00:00
Gary Wilson Jr 193e6db457 Refs #2591 -- Removed int conversion and try/except since the value in the single-item list is already an int. I overlooked this in my original patch, which was applied in [5679].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5690 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-13 20:36:01 +00:00
Malcolm Tredinnick 54a71805aa Fixed #2591 -- Fixed a problem with inspectdb with psycopg2 (only). Patch from
Gary Wilson.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5679 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-13 08:52:07 +00:00
Malcolm Tredinnick 953badbea5 Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.

Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 12:11:04 +00:00
Jacob Kaplan-Moss 24512a74be Fixed #1465: added support for regex lookups. Thanks, Tom Tobin.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5555 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-06-27 18:58:10 +00:00
Malcolm Tredinnick 14161dba6b Fixed #4678 -- Fixed table name matching during syncdb for pyscopg2 backend
(the psycopg backend was already correct). Patch from tailofthesun@gmail.com.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5528 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-06-25 03:08:00 +00:00
Malcolm Tredinnick ac64e91a0c Merged boulder-oracle-sprint branch (r3965:5512) back into trunk. All
expected tests pass for all databases.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5519 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-06-23 14:16:00 +00:00
Malcolm Tredinnick 86fd59cfa5 Fixed #4432 -- Fixed PostgreSQL sequence resetting in the case when a table has
no rows yet. Thanks, mrmachine.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5455 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-06-10 03:31:26 +00:00
Malcolm Tredinnick 92c35a0617 Fixed #2365, #3324 -- Renamed FloatField to DecimalField and changed the code
to return Decimal instances in Python for this field. Backwards incompatible
change.

Added a real FloatField (stores floats in the database) and support for
FloatField and DecimalField in newforms (analogous to IntegerField).

Included decimal.py module (as django.utils._decimal) from Python 2.4. This is
license compatible with Django and included for Python 2.3 compatibility only.

Large portions of this work are based on patches from Andy Durdin and Jorge
Gajon.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@5302 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-21 01:29:58 +00:00
Russell Keith-Magee fd17163481 Fixed #4231 -- Added quoting for sequence names on sequence reset for PostgreSQL. This was causing difficulties if table or application names were capitalized. Thanks for the report, Mark Jarecki.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5204 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-12 15:21:33 +00:00
Malcolm Tredinnick b3e0b59def Fixed #3450 -- Exposed IntegrityError in a backend-neutral fashion. This is a
useful error to be able to catch explicitly. Thanks, enlight.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5076 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-25 10:18:56 +00:00
Russell Keith-Magee c5f08954d5 Fixed #4057 -- Fixed problem with quoting of sequence names on Postgres backends. Thanks, Gary Wilson.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5017 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-17 11:11:26 +00:00
Russell Keith-Magee dabd96646c Fixed #3790 -- Fixed a problem with sequence resetting during fixture loads when using Postgres. Thanks to Jon Ballard and scott@staplefish.com for the report, and to Zach Thompson for suggesting a solution.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4937 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-06 02:25:58 +00:00
Malcolm Tredinnick cc8d656569 Fixed #3024 -- Fixed database commit() and rollback() behaviour so it works
consistently if you execute them before Django has made a database connection.
Thanks Bastian Kleineidam.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4691 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-09 07:55:40 +00:00
Malcolm Tredinnick dd99bc7d02 Fixed #3627 -- Made [4659] compatible with Python 2.3. Thanks, Gary Wilson.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4662 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-02 05:15:27 +00:00
Jacob Kaplan-Moss a72f908924 Changed the postgres version getting code to use cursor.fetchone() instead of dictfetchone(); some versions (including mine) of psycopg don't export dictfetch functions.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4660 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-01 17:54:35 +00:00
Russell Keith-Magee f2582eb972 Fixes #2333 -- Added test fixtures framework.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4659 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-01 13:11:08 +00:00
Jacob Kaplan-Moss 51f39d59bd Fixed #3390: the serializer can now contain forward references. Thanks, Russ.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4610 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-26 17:33:27 +00:00
Jacob Kaplan-Moss dcdaa4ac3c Fixed #3459: Django no longer runs SET TIME ZONE for every query when using Postgres. This should result in a pretty noticible speedup for Postgres users, so many thanks to Jack Moffitt for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4573 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-25 16:18:46 +00:00
Jacob Kaplan-Moss fef89a01c5 Fixed #2866: Added DATABASE_OPTIONS setting which gets passed as extra kwargs to the backend's connect method. Thanks, ymasuda.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4048 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-07 05:17:38 +00:00
Jacob Kaplan-Moss 6152b325aa Made psycopg2 backend actually support dictfetch* methods.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3727 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-09-05 16:12:36 +00:00
Jacob Kaplan-Moss 0e577430e9 Made psycopg2 backend behave the same as the other backends when it comes to unicode and datetime time zone info. See [http://groups.google.com/group/django-developers/browse_frm/thread/4575a3fe0d78e2e4/d607d96f7b422620#d607d96f7b422620 the django-dev thread] for details.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3675 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-08-28 20:00:47 +00:00
Adrian Holovaty 9cd0c333d6 Fixed #2514 -- Improved psycopg2 backend to save/load Unicode strings correctly. Thanks, crankycoder@gmail.com
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3565 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-08-12 05:15:25 +00:00
Jacob Kaplan-Moss 17d0bd1512 Fixed a bunch of spurious imports, typos, and other small errors turned up by a pass through PyFlakes. This covers about the first third of the errors.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3411 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-07-21 17:11:13 +00:00
Malcolm Tredinnick 7e2b888a2d Fixed #2108 -- allow saving of empty models, rather than just dropping them.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3115 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-08 15:14:06 +00:00
Adrian Holovaty 168429d597 Fixed #593 -- Added 'search' DB-API lookup type, which does full-text index searches in MySQL
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3073 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-03 23:28:24 +00:00
Adrian Holovaty fa9722489b Fixed #2061 -- Fixed PostgreSQL index introspection in tables that have dropped columns. Thanks, Chris Chamberlin
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3047 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-01 16:27:41 +00:00
Adrian Holovaty 8e9833f261 Fixed #1673 -- Every database backend now raises ImproperlyConfigured if the relevant Python database module raises ImportError
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2993 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-26 18:58:46 +00:00
Adrian Holovaty 0ed64fe329 Fixed #1904 -- Got postgresql_psycopg2 backend working. Thanks for the patch, germish@gmail.com
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2934 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-18 03:36:58 +00:00
Adrian Holovaty 88ca662e75 Added postgresql_psycopg2 backend, which is untested, just for a starting point
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2928 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-16 23:27:07 +00:00