#23807: Postgres backend throws error when coercing psycopg2 version string to
int
when version contains non-numeric characters
----------------------------------------------+--------------------
Reporter: ryanbagwell | Owner: nobody
Type: Bug | Status: new
Component: Database layer (models, ORM) | Version: 1.7
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------------------+--------------------
The postgres backend that ships with Django expects the version string of
psycopg2 to contain numeric characters. It then tries to coerce the string
to a tuple, i.e. (2, 5, 4,) for '2.5.4'. This throws an error when using
the development branch, which has a version string of '2.6.dev0' (you
can't coerce "dev0" to a string.
The problem method is located here:
https://github.com/django/django/blob/master/django/db/backends/postgresql_psycopg2/base.py#L202
{{{
@cached_property
def psycopg2_version(self):
version = psycopg2.__version__.split(' ', 1)[0]
return tuple(int(v) for v in version.split('.'))
}}}
This was a problem for me due to a bug in psycopg2 that was fixed in the
dev branch but not in the most recent release.
I don't know how best to address it. Do other applications expect the
version tuple to consist entirely of integers?
--
Ticket URL: <https://code.djangoproject.com/ticket/23807>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/054.b52a9db8137bd0bb11eed6ec7e8aaab6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.