diff --git a/django/db/backends/postgresql/operations.py b/django/db/backends/postgresql/operations.py
index 20392b2..bd8266b 100644
a
|
b
|
class DatabaseOperations(BaseDatabaseOperations):
|
12 | 12 | from django.db import connection |
13 | 13 | cursor = connection.cursor() |
14 | 14 | cursor.execute("SELECT version()") |
15 | | self._postgres_version = [int(val) for val in cursor.fetchone()[0].split()[1].split('.')] |
| 15 | version_parts = cursor.fetchone()[0].split()[1].split('.') |
| 16 | postgres_version = [] |
| 17 | for part in version_parts: |
| 18 | if part.isdigit(): |
| 19 | postgres_version.append(int(part)) |
| 20 | else: |
| 21 | digit = "" |
| 22 | for c in part: |
| 23 | if c.isdigit(): |
| 24 | digit += c |
| 25 | else: |
| 26 | break |
| 27 | if digit != "": |
| 28 | postgres_version.append(int(digit)) |
| 29 | break |
| 30 | self._postgres_version = postgres_version |
16 | 31 | return self._postgres_version |
17 | 32 | postgres_version = property(_get_postgres_version) |