Ticket #6433: postgres-funny-version2.diff

File postgres-funny-version2.diff, 866 bytes (added by Trevor Caira, 17 years ago)
  • django/db/backends/postgresql/operations.py

     
    99
    1010    def _get_postgres_version(self):
    1111        if self._postgres_version is None:
     12            import re
    1213            from django.db import connection
     14            version_search = re.compile(r'(\d+)\.(\d+)').search
    1315            cursor = connection.cursor()
    1416            cursor.execute("SELECT version()")
    15             self._postgres_version = [int(val) for val in cursor.fetchone()[0].split()[1].split('.')]
     17            self._postgres_version = map(int, version_search(cursor.fetchone()[0]).groups())
    1618        return self._postgres_version
    1719    postgres_version = property(_get_postgres_version)
    1820
Back to Top