Opened 6 years ago

Closed 14 months ago

#10509 closed Bug (wontfix)

Better handling of database version-specific feature initialisation

Reported by: mtredinnick Owned by: Xof
Component: Database layer (models, ORM) Version: master
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

Description

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 Changed 6 years ago by mtredinnick

(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 Changed 6 years ago by Alex

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 6 years ago by Richard Davies <richard.davies@…>

  • Cc richard.davies@… added

comment:4 Changed 6 years ago by Xof

  • Owner changed from nobody to Xof
  • Status changed from new to assigned

comment:5 Changed 4 years ago by SmileyChris

  • Severity set to Normal
  • Type set to Bug

comment:6 Changed 4 years ago by ramiro

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
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.

comment:4 Changed 3 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:5 Changed 3 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

comment:6 Changed 14 months ago by aaugustin

  • Resolution set to wontfix
  • Status changed from assigned to closed

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