Opened 17 years ago
Closed 17 years ago
#7090 closed (fixed)
postgresql_psycopg2 blows up when you try to create a cursor with postgresql 8.3.1 on windows
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 0.96 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
On windows, configured to work with postgresql 8.3.1 creating a cursor blows up due to the format of the postgresql version string.
>>> from django.db import connection >>> cursor = connection.cursor() Traceback (most recent call last): File "<console>", line 1, in <module> File "C:\python25\lib\site-packages\django\db\backends\postgresql_psycopg2\base.py", line 57, in cursor postgres_version = [int(val) for val in cursor.fetchone()[0].split()[1].split('.')] ValueError: invalid literal for int() with base 10: '1,'
The version string returned by postgresql was 'PostgreSQL 8.3.1, compiled by Visual C++ build 1400'
It is choking on the comma after the version number. Here is a modified base.py line 57 that fixes the problem:
postgres_version = [int(val) for val in cursor.fetchone()[0].split()[1].replace(',','').split('.')]
Note:
See TracTickets
for help on using tickets.
This is fixed in trunk r7415.