[Django] #24335: DateRange and friends require psycopg2 >= 2.5

13 views
Skip to first unread message

Django

unread,
Feb 12, 2015, 2:57:23 PM2/12/15
to django-...@googlegroups.com
#24335: DateRange and friends require psycopg2 >= 2.5
-------------------------------------+-------------------------------------
Reporter: claudep | Owner:
Type: | Status: new
Cleanup/optimization |
Component: | Version: 1.8alpha1
contrib.postgres |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Currently, if your psycopg2 version is lower than 2.5, you cannot import
any of contrib.postgres fields or forms, as ranges.py is unconditionally
imported in their `__init__`.

On one side, this should be documented, and on the other side we should
still allow other fields/forms (array/hstore) to be imported (maybe raise
a RuntimeWarning for the ranges import failure?).

--
Ticket URL: <https://code.djangoproject.com/ticket/24335>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 12, 2015, 8:37:45 PM2/12/15
to django-...@googlegroups.com
#24335: DateRange and friends require psycopg2 >= 2.5
-------------------------------------+-------------------------------------
Reporter: claudep | Owner:
Type: | Status: new
Cleanup/optimization |
Component: contrib.postgres | Version: 1.8alpha1
Severity: Normal | Resolution:
Keywords: 1.8-beta | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* cc: mjtamlyn (added)
* keywords: => 1.8-beta
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/24335#comment:1>

Django

unread,
Feb 13, 2015, 11:12:18 PM2/13/15
to django-...@googlegroups.com
#24335: DateRange and friends require psycopg2 >= 2.5
-------------------------------------+-------------------------------------
Reporter: claudep | Owner: ovangle
Type: | Status: assigned

Cleanup/optimization |
Component: contrib.postgres | Version: 1.8alpha1
Severity: Normal | Resolution:
Keywords: 1.8-beta | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by ovangle):

* owner: => ovangle
* cc: ovangle@… (added)
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/24335#comment:2>

Django

unread,
Feb 14, 2015, 2:20:39 AM2/14/15
to django-...@googlegroups.com
#24335: DateRange and friends require psycopg2 >= 2.5
-------------------------------------+-------------------------------------
Reporter: claudep | Owner: ovangle
Type: | Status: assigned
Cleanup/optimization |
Component: contrib.postgres | Version: 1.8alpha1
Severity: Normal | Resolution:
Keywords: 1.8-beta | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by mjtamlyn):

Personally I would be happy to simply require psycopg2 >= 2.5 - that
version was released nearly 2 years ago now and I don't see any particular
reason why we need to support older versions.

At the moment there is one mention of the required version, in
`docs/ref/databases.txt`. This was updated to 2.0.9 earlier in this
release cycle to support `UUIDField`.

--
Ticket URL: <https://code.djangoproject.com/ticket/24335#comment:3>

Django

unread,
Feb 14, 2015, 3:01:10 AM2/14/15
to django-...@googlegroups.com
#24335: DateRange and friends require psycopg2 >= 2.5
-------------------------------------+-------------------------------------
Reporter: claudep | Owner: ovangle
Type: | Status: assigned
Cleanup/optimization |
Component: contrib.postgres | Version: 1.8alpha1
Severity: Normal | Resolution:
Keywords: 1.8-beta | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by ovangle):

I've submitted a patch https://github.com/django/django/pull/4131 which
conditionally defines the classes if an `ImportError` is raised when
importing psycopg2.extras.Range.

I'm happy changing it to require `psycopg2>=2.5`, but obviously since this
is my first contribution a suggestion like that was not my call to make
and the bug as described had been accepted, so I implemented it directly
as stated. Personally, my opinion on these matters is usually "continue
support for the last two major versions of a package".

--
Ticket URL: <https://code.djangoproject.com/ticket/24335#comment:4>

Django

unread,
Feb 14, 2015, 3:05:27 AM2/14/15
to django-...@googlegroups.com
#24335: DateRange and friends require psycopg2 >= 2.5
-------------------------------------+-------------------------------------
Reporter: claudep | Owner: ovangle
Type: | Status: assigned
Cleanup/optimization |
Component: contrib.postgres | Version: 1.8alpha1
Severity: Normal | Resolution:
Keywords: 1.8-beta | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by mjtamlyn):

Psycopg2 2.6 was released last week -
http://initd.org/psycopg/articles/2015/02/09/psycopg-26-and-255-released/

--
Ticket URL: <https://code.djangoproject.com/ticket/24335#comment:5>

Django

unread,
Feb 14, 2015, 3:26:58 AM2/14/15
to django-...@googlegroups.com
#24335: DateRange and friends require psycopg2 >= 2.5
-------------------------------------+-------------------------------------
Reporter: claudep | Owner: ovangle
Type: | Status: assigned
Cleanup/optimization |
Component: contrib.postgres | Version: 1.8alpha1
Severity: Normal | Resolution:
Keywords: 1.8-beta | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by ovangle):

I was aware of that, but I meant the two previous major versions (so, not
including the current version). It's arbitrary anyway and since this is
entirely new functionality in an optional module, it's a little early to
be littering the code with conditional imports.

`>= 2.5` is OK with me.

--
Ticket URL: <https://code.djangoproject.com/ticket/24335#comment:6>

Django

unread,
Feb 14, 2015, 3:27:58 AM2/14/15
to django-...@googlegroups.com
#24335: DateRange and friends require psycopg2 >= 2.5
-------------------------------------+-------------------------------------
Reporter: claudep | Owner: ovangle
Type: | Status: assigned
Cleanup/optimization |
Component: contrib.postgres | Version: 1.8alpha1
Severity: Normal | Resolution:
Keywords: 1.8-beta | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by ovangle):

I was aware of that, but I meant the two previous major versions (so, not
including the current version). It's arbitrary anyway and since this is
entirely new functionality in an optional module, it's a little early to
be littering the code with conditional imports.

`>= 2.5` is OK with me.

--
Ticket URL: <https://code.djangoproject.com/ticket/24335#comment:7>

Django

unread,
Feb 14, 2015, 5:06:40 AM2/14/15
to django-...@googlegroups.com
#24335: DateRange and friends require psycopg2 >= 2.5
-------------------------------------+-------------------------------------
Reporter: claudep | Owner: ovangle
Type: | Status: assigned
Cleanup/optimization |
Component: contrib.postgres | Version: 1.8alpha1
Severity: Normal | Resolution:
Keywords: 1.8-beta | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by claudep):

Requiring `psycopg2>=2.5` would literally force many users to use a pip-
installed `psycopg2` instead of the system one, as many stable
distributions still have an older version. But if we agree that's an
acceptable requirement for a contrib package, then go for it (and document
it, of course).

--
Ticket URL: <https://code.djangoproject.com/ticket/24335#comment:8>

Django

unread,
Feb 14, 2015, 8:46:01 AM2/14/15
to django-...@googlegroups.com
#24335: DateRange and friends require psycopg2 >= 2.5
-------------------------------------+-------------------------------------
Reporter: claudep | Owner: ovangle
Type: | Status: assigned
Cleanup/optimization |
Component: contrib.postgres | Version: 1.8alpha1
Severity: Normal | Resolution:
Keywords: 1.8-beta | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by ovangle):

While testing this, it seems that
https://github.com/django/django/commit/39d95fb6ada99c59d47fa0eae6d3128abafe2d58
dropped support for psycopg2 <= 2.4.3 globally (new_array_type was added
in 2.4.3). I'm just going to add a check for the version >= 2.5 into
`django.db.backends.postgres_pyscopg2` and update
`docs/ref/databases.txt`.

--
Ticket URL: <https://code.djangoproject.com/ticket/24335#comment:9>

Django

unread,
Feb 14, 2015, 8:55:30 AM2/14/15
to django-...@googlegroups.com
#24335: DateRange and friends require psycopg2 >= 2.5
-------------------------------------+-------------------------------------
Reporter: claudep | Owner: ovangle
Type: | Status: assigned
Cleanup/optimization |
Component: contrib.postgres | Version: 1.8alpha1
Severity: Normal | Resolution:
Keywords: 1.8-beta | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by mjtamlyn):

The relevant array code added in that commit is actually only needed for
contrib.postgres in theory, but it might be quite complicated to
conditionally include it as it also changes the way
`GenericIPAddressField` works, I think. For reference, 2.4.3 was released
December 2011.

It is however worth noting that postgres provides an rpm package for rhel6
for psycopg2 2.4.5 if people care about that. Personally, I don't care all
that much about OS level packages. I don't now if we have any kind of
official policy on them.

--
Ticket URL: <https://code.djangoproject.com/ticket/24335#comment:10>

Django

unread,
Feb 14, 2015, 9:30:46 AM2/14/15
to django-...@googlegroups.com
#24335: DateRange and friends require psycopg2 >= 2.5
-------------------------------------+-------------------------------------
Reporter: claudep | Owner: ovangle
Type: | Status: assigned
Cleanup/optimization |
Component: contrib.postgres | Version: 1.8alpha1
Severity: Normal | Resolution:
Keywords: 1.8-beta | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by ovangle):

I'll defer completing this until I get some consensus about minimum
supported versions.

It seems that `2.5` is an OK minimum for `django.contrib.postgres`, but
`2.4.5` added support for Inet arrays to the `Inet` object, so that's the
current minimum supported version for `db.backends` without a change to
the current code (at least a more informative error than the current one
about new_array_type being unavailable).

--
Ticket URL: <https://code.djangoproject.com/ticket/24335#comment:11>

Django

unread,
Feb 16, 2015, 12:22:04 PM2/16/15
to django-...@googlegroups.com
#24335: DateRange and friends require psycopg2 >= 2.5
-------------------------------------+-------------------------------------
Reporter: claudep | Owner: timgraham

Type: | Status: assigned
Cleanup/optimization |
Component: contrib.postgres | Version: 1.8alpha1
Severity: Normal | Resolution:
Keywords: 1.8-beta | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* owner: ovangle => timgraham
* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/4148 New PR] that implements this
proposal from the [https://groups.google.com/d/topic/django-
developers/viXbNzfl64g/discussion mailing list thread]:

* Document 2.4.3 as the minimum if you don't want to use contrib.postgres
* Document 2.5 as the minimum to use contrib.postgres
* Require 2.5+ for Django's test suite to avoid having to add conditional
imports/test skipping.

--
Ticket URL: <https://code.djangoproject.com/ticket/24335#comment:12>

Django

unread,
Feb 17, 2015, 6:20:44 AM2/17/15
to django-...@googlegroups.com
#24335: DateRange and friends require psycopg2 >= 2.5
-------------------------------------+-------------------------------------
Reporter: claudep | Owner: timgraham
Type: | Status: closed

Cleanup/optimization |
Component: contrib.postgres | Version: 1.8alpha1
Severity: Normal | Resolution: fixed

Keywords: 1.8-beta | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"3adc5f1ee6618a615db07d4a868b366a15c39f82"]:
{{{
#!CommitTicketReference repository=""
revision="3adc5f1ee6618a615db07d4a868b366a15c39f82"
Fixed #24335 -- Bumped required psycopg2 version to 2.4.5 (2.5 for
contrib.postgres).
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24335#comment:13>

Django

unread,
Feb 17, 2015, 6:34:18 AM2/17/15
to django-...@googlegroups.com
#24335: DateRange and friends require psycopg2 >= 2.5
-------------------------------------+-------------------------------------
Reporter: claudep | Owner: timgraham
Type: | Status: closed
Cleanup/optimization |
Component: contrib.postgres | Version: 1.8alpha1
Severity: Normal | Resolution: fixed
Keywords: 1.8-beta | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"730fb593ad19731e7018dd83236318bfe71de86a"]:
{{{
#!CommitTicketReference repository=""
revision="730fb593ad19731e7018dd83236318bfe71de86a"
[1.8.x] Fixed #24335 -- Bumped required psycopg2 version to 2.4.5 (2.5 for
contrib.postgres).

Backport of 3adc5f1ee6618a615db07d4a868b366a15c39f82 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24335#comment:14>

Reply all
Reply to author
Forward
0 new messages