[Django] #27966: db.backends.postgresql checks for psycopg2 2.4.5, but actually 2.5 is required

60 views
Skip to first unread message

Django

unread,
Mar 20, 2017, 5:09:16 PM3/20/17
to django-...@googlegroups.com
#27966: db.backends.postgresql checks for psycopg2 2.4.5, but actually 2.5 is
required
-------------------------------------+-------------------------------------
Reporter: karyon | Owner: nobody
Type: Bug | Status: new
Component: Database | Version: 1.11
layer (models, ORM) |
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 |
-------------------------------------+-------------------------------------
[https://github.com/django/django/commit/b484f167bed61f4cff215208eddf98a0655239d4
#diff-aef216ccdc37941bfed98ea3c80f7642R200 this commit ] uses the cursor
as context manager (line in question is marked), which were added in
psycopg2 2.5 ([http://initd.org/psycopg/docs/news.html#what-s-new-in-
psycopg-2-5 release notes]) (see third item)

but
[https://github.com/django/django/blob/master/django/db/backends/postgresql/base.py#L33
here] django checks only for 2.4.5.

[https://github.com/django/django/commit/3adc5f1ee6618a615db07d4a868b366a15c39f82
this commit here] made 2.4.5 a requirement and documented that in a few
places.

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

Django

unread,
Mar 20, 2017, 5:45:36 PM3/20/17
to django-...@googlegroups.com
#27966: db.backends.postgresql checks for psycopg2 2.4.5, but actually 2.5 is
required
-------------------------------------+-------------------------------------
Reporter: karyon | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

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

Comment (by karyon):

i tested with psycopg2 2.5.0 and after this i directly got the next crash,
with 2.5.5 (the newest 2.5.x) that one was fixed too. so if you decide to
update the requirements, i would suggest to require 2.5.5.

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

Django

unread,
Mar 20, 2017, 6:22:03 PM3/20/17
to django-...@googlegroups.com
#27966: db.backends.postgresql checks for psycopg2 2.4.5, but actually 2.5 is
required
-------------------------------------+-------------------------------------
Reporter: karyon | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

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

* severity: Normal => Release blocker
* stage: Unreviewed => Accepted


Comment:

In all cases I think the code should be refactored to use `self.cursor()`
instead of `self.connection.cursor()` which doesn't suffer from this issue
and is appropriately wrapped.

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

Django

unread,
Mar 21, 2017, 12:53:17 AM3/21/17
to django-...@googlegroups.com
#27966: db.backends.postgresql checks for psycopg2 2.4.5, but actually 2.5 is
required
-------------------------------------+-------------------------------------
Reporter: karyon | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

* has_patch: 0 => 1


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

Django

unread,
Mar 21, 2017, 4:58:59 AM3/21/17
to django-...@googlegroups.com
#27966: db.backends.postgresql checks for psycopg2 2.4.5, but actually 2.5 is
required
-------------------------------------+-------------------------------------
Reporter: karyon | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

Comment (by Asif Saifuddin Auvi):

All suggested changes applied. Build are passing. just docs failure. does
this worth a mention in release notes?

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

Django

unread,
Mar 21, 2017, 8:34:56 AM3/21/17
to django-...@googlegroups.com
#27966: db.backends.postgresql checks for psycopg2 2.4.5, but actually 2.5 is
required
-------------------------------------+-------------------------------------
Reporter: karyon | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | 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):

I think we must increases the minimum psycopg2 version to 2.5.4, due to
the server-side cursors patch, f3b7c059367a4e82bbfc7e4f0d42b10975e79f0c.
Running Django's test suite gives these errors:

psycopg2 < 2.5, e.g. 2.4.6
{{{
File "/home/tim/code/django/django/db/backends/postgresql/base.py", line
213, in create_cursor
cursor = self.connection.cursor(name, scrollable=False,
withhold=self.connection.autocommit)
TypeError: 'scrollable' is an invalid keyword argument for this function
}}}
2.5 ≤ psycopg2 < 2.5.4
{{{
File "/home/tim/code/django/django/db/models/query.py", line 50, in
__iter__
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
File "/home/tim/code/django/django/db/models/sql/compiler.py", line 876,
in execute_sql
cursor.close()
psycopg2.OperationalError: cursor "_django_curs_140304550061888_1" does
not exist
}}}
Is there value in the cursor patch if that's the case?

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

Django

unread,
Mar 21, 2017, 10:56:31 AM3/21/17
to django-...@googlegroups.com
#27966: db.backends.postgresql checks for psycopg2 2.4.5, but actually 2.5 is
required
-------------------------------------+-------------------------------------
Reporter: karyon | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

Comment (by Simon Charette):

If server side cursors require psycopg2 >= 2.5.4 we should just document
that it's the minimum required version and avoid making this change.

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

Django

unread,
Mar 21, 2017, 11:18:14 AM3/21/17
to django-...@googlegroups.com
#27966: db.backends.postgresql checks for psycopg2 2.4.5, but actually 2.5 is
required
-------------------------------------+-------------------------------------
Reporter: karyon | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

Comment (by Adam (Chainz) Johnson):

Agree, didn't realize that.

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

Django

unread,
Mar 21, 2017, 11:40:20 AM3/21/17
to django-...@googlegroups.com
#27966: db.backends.postgresql checks for psycopg2 2.4.5, but actually 2.5 is
required
-------------------------------------+-------------------------------------
Reporter: karyon | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

Comment (by Asif Saifuddin Auvi):

Is it fixed then? or this ticket is invalid?

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

Django

unread,
Mar 21, 2017, 11:41:01 AM3/21/17
to django-...@googlegroups.com
#27966: db.backends.postgresql checks for psycopg2 2.4.5, but actually 2.5 is
required
-------------------------------------+-------------------------------------
Reporter: karyon | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

Comment (by Claude Paroz):

Debian stable has 2.5.4, by the way.

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

Django

unread,
Mar 21, 2017, 11:46:53 AM3/21/17
to django-...@googlegroups.com
#27966: db.backends.postgresql checks for psycopg2 2.4.5, but actually 2.5 is
required
-------------------------------------+-------------------------------------
Reporter: karyon | Owner: felixxm
Type: Bug | Status: assigned

Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

* owner: nobody => felixxm
* status: new => assigned


Comment:

[https://github.com/django/django/pull/8228 PR]

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

Django

unread,
Mar 21, 2017, 11:56:05 AM3/21/17
to django-...@googlegroups.com
#27966: Bump required version of pyscopg2 to 2.5.4

-------------------------------------+-------------------------------------
Reporter: karyon | Owner: felixxm
Type: Bug | Status: assigned
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

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

* stage: Accepted => Ready for checkin


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

Django

unread,
Mar 21, 2017, 12:18:38 PM3/21/17
to django-...@googlegroups.com
#27966: Bump required version of pyscopg2 to 2.5.4
-------------------------------------+-------------------------------------
Reporter: karyon | Owner: felixxm
Type: Bug | Status: assigned
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

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

Comment (by Aymeric Augustin):

Debian stable also has Django 1.7 ;-)

https://packages.debian.org/jessie/python-django

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

Django

unread,
Mar 21, 2017, 12:23:32 PM3/21/17
to django-...@googlegroups.com
#27966: Bump required version of pyscopg2 to 2.5.4
-------------------------------------+-------------------------------------
Reporter: karyon | Owner: felixxm
Type: Bug | Status: closed

Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Release blocker | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

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

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


Comment:

In [changeset:"43380e911073beab401a2fdeca0f25001e170dac" 43380e91]:
{{{
#!CommitTicketReference repository=""
revision="43380e911073beab401a2fdeca0f25001e170dac"
Fixed #27966 -- Bumped required psycopg2 version to 2.5.4.

Thanks Tim Graham for the review.
}}}

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

Django

unread,
Mar 21, 2017, 12:41:14 PM3/21/17
to django-...@googlegroups.com
#27966: Bump required version of pyscopg2 to 2.5.4
-------------------------------------+-------------------------------------
Reporter: karyon | Owner: felixxm
Type: Bug | Status: closed
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

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

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"b06855facdd0fd1eecae7bce75c815c8a6af19b6" b06855fa]:
{{{
#!CommitTicketReference repository=""
revision="b06855facdd0fd1eecae7bce75c815c8a6af19b6"
[1.11.x] Fixed #27966 -- Bumped required psycopg2 version to 2.5.4.

Thanks Tim Graham for the review.

Backport of 43380e911073beab401a2fdeca0f25001e170dac from master
}}}

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

Reply all
Reply to author
Forward
0 new messages