Code

Opened 5 years ago

Closed 3 years ago

#11065 closed Cleanup/optimization (fixed)

Improve version comparison functions, esp for PostgreSQL

Reported by: russellm Owned by: nobody
Component: Database layer (models, ORM) Version: 1.0
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The PostgreSQL backend currently implements a get_version function that returns a tuple (e.g., (8,3,1) ) that describes the version of the PostgreSQL server. This version tuple is then used in many locations to determine feature availability - for example, between 8.2 and 8.2.4, STDDEV_POP is known to be broken, and errors will be raised.

Version comparisons are implemented in multiple locations, using different techniques. This should be cleaned up and improved so that the process of identifying versions can be improved without affecting the version comparisons that are required. This probably means writing a function that returns -1/0/1 comparing one version to another version.

This is an offshoot of #10842 - more discussion and context is available on that ticket.

Attachments (0)

Change History (3)

comment:1 Changed 5 years ago by Alex

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

comment:2 Changed 3 years ago by julien

  • Severity set to Normal
  • Type set to Cleanup/optimization

comment:3 Changed 3 years ago by ramiro

  • Resolution set to fixed
  • Status changed from new to closed

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.