Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Corrected PostgreSQL version comparisons from r10730. Thanks to rozwe…

…ll for the report on IRC.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10735 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 4f9fd449658132362c8274e1fec96df5e843cf05 1 parent fe971ec
Russell Keith-Magee authored May 11, 2009
2  django/db/backends/postgresql/base.py
@@ -121,7 +121,7 @@ def _cursor(self):
121 121
             cursor.execute("SET TIME ZONE %s", [settings_dict['TIME_ZONE']])
122 122
             if not hasattr(self, '_version'):
123 123
                 self.__class__._version = get_version(cursor)
124  
-            if self._version[0:2] < [8, 0]:
  124
+            if self._version[0:2] < (8, 0):
125 125
                 # No savepoint support for earlier version of PostgreSQL.
126 126
                 self.features.uses_savepoints = False
127 127
         cursor.execute("SET client_encoding to 'UNICODE'")
6  django/db/backends/postgresql/operations.py
@@ -66,7 +66,7 @@ def quote_name(self, name):
66 66
 
67 67
     def sql_flush(self, style, tables, sequences):
68 68
         if tables:
69  
-            if self.postgres_version[0:2] >= [8,1]:
  69
+            if self.postgres_version[0:2] >= (8,1):
70 70
                 # Postgres 8.1+ can do 'TRUNCATE x, y, z...;'. In fact, it *has to*
71 71
                 # in order to be able to truncate tables referenced by a foreign
72 72
                 # key in any other table. The result is a single SQL TRUNCATE
@@ -154,10 +154,10 @@ def check_aggregate_support(self, aggregate):
154 154
         NotImplementedError if this is the database in use.
155 155
         """
156 156
         if aggregate.sql_function in ('STDDEV_POP', 'STDDEV_SAMP', 'VAR_POP', 'VAR_SAMP'):
157  
-            if self.postgres_version[0:2] < [8,2]:
  157
+            if self.postgres_version[0:2] < (8,2):
158 158
                 raise NotImplementedError('PostgreSQL does not support %s prior to version 8.2. Please upgrade your version of PostgreSQL.' % aggregate.sql_function)
159 159
 
160 160
         if aggregate.sql_function in ('STDDEV_POP', 'VAR_POP'):
161  
-            if self.postgres_version[0:2] == [8,2]:
  161
+            if self.postgres_version[0:2] == (8,2):
162 162
                 if self.postgres_version[2] is None or self.postgres_version[2] <= 4:
163 163
                     raise NotImplementedError('PostgreSQL 8.2 to 8.2.4 is known to have a faulty implementation of %s. Please upgrade your version of PostgreSQL.' % aggregate.sql_function)

0 notes on commit 4f9fd44

Please sign in to comment.
Something went wrong with that request. Please try again.