Opened 15 years ago

Closed 10 years ago

#10509 closed Bug (wontfix)

Better handling of database version-specific feature initialisation

Reported by: Malcolm Tredinnick Owned by: Christophe Pettus
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: richard.davies@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Right now, we have problems such as those mentioned in #10467 (comment 4). If a part of Django wants to use a particular feature that depends on the database version, it needs to first have talked to the database. This breaks in some edge-cases.

Some alternative possibilities are

  1. understanding deferred-features, but that looks hard. For example, it's difficult to imagine how "return ID from insert" can work in that fashion without being really ugly code.
  2. requiring the settings file to include the version information so we don't have to make the wasteful SELECT version(); (or equivalent) call for every database connection. It's essentially unchanging information.

Anyway, that's a discussion for later (I'll start a thread on django-dev at some point). Opening the ticket to remind me to look at this.

Change History (9)

comment:1 by Malcolm Tredinnick, 15 years ago

(In [10065]) 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.

comment:2 by Alex Gaynor, 15 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Richard Davies <richard.davies@…>, 15 years ago

Cc: richard.davies@… added

comment:4 by Christophe Pettus, 14 years ago

Owner: changed from nobody to Christophe Pettus
Status: newassigned

comment:5 by Chris Beaven, 13 years ago

Severity: Normal
Type: Bug

comment:6 by Ramiro Morales, 13 years ago

In [16439]:

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

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.

comment:4 by Aymeric Augustin, 12 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:5 by Aymeric Augustin, 12 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:6 by Aymeric Augustin, 10 years ago

Resolution: wontfix
Status: assignedclosed

Django now support persistent connections, which alleviate the overhead of version checking. And Malcolm will never do what he had in mind.

Considering that there isn't a concrete proposal and that there hasn't been much activity in three years, I'm going to close this ticket.

Note: See TracTickets for help on using tickets.
Back to Top