#27966 closed Bug (fixed)
Bump required version of pyscopg2 to 2.5.4
Reported by: | karyon | Owned by: | Mariusz Felisiak |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.11 |
Severity: | Release blocker | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
this commit uses the cursor as context manager (line in question is marked), which were added in psycopg2 2.5 (release notes) (see third item)
but here django checks only for 2.4.5.
this commit here made 2.4.5 a requirement and documented that in a few places.
Change History (14)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
Severity: | Normal → Release blocker |
---|---|
Triage Stage: | Unreviewed → Accepted |
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.
comment:3 by , 8 years ago
Has patch: | set |
---|
comment:4 by , 8 years ago
All suggested changes applied. Build are passing. just docs failure. does this worth a mention in release notes?
comment:5 by , 8 years ago
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?
comment:6 by , 8 years ago
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.
comment:11 by , 8 years ago
Summary: | db.backends.postgresql checks for psycopg2 2.4.5, but actually 2.5 is required → Bump required version of pyscopg2 to 2.5.4 |
---|---|
Triage Stage: | Accepted → Ready for checkin |
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.