Skip to content

Commit

Permalink
Corrected PostgreSQL version comparisons from r10730. Thanks to rozwe…
Browse files Browse the repository at this point in the history
…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
freakboy3742 committed May 11, 2009
1 parent fe971ec commit 4f9fd44
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion django/db/backends/postgresql/base.py
Expand Up @@ -121,7 +121,7 @@ def _cursor(self):
cursor.execute("SET TIME ZONE %s", [settings_dict['TIME_ZONE']])
if not hasattr(self, '_version'):
self.__class__._version = get_version(cursor)
if self._version[0:2] < [8, 0]:
if self._version[0:2] < (8, 0):
# No savepoint support for earlier version of PostgreSQL.
self.features.uses_savepoints = False
cursor.execute("SET client_encoding to 'UNICODE'")
Expand Down
6 changes: 3 additions & 3 deletions django/db/backends/postgresql/operations.py
Expand Up @@ -66,7 +66,7 @@ def quote_name(self, name):

def sql_flush(self, style, tables, sequences):
if tables:
if self.postgres_version[0:2] >= [8,1]:
if self.postgres_version[0:2] >= (8,1):
# Postgres 8.1+ can do 'TRUNCATE x, y, z...;'. In fact, it *has to*
# in order to be able to truncate tables referenced by a foreign
# key in any other table. The result is a single SQL TRUNCATE
Expand Down Expand Up @@ -154,10 +154,10 @@ def check_aggregate_support(self, aggregate):
NotImplementedError if this is the database in use.
"""
if aggregate.sql_function in ('STDDEV_POP', 'STDDEV_SAMP', 'VAR_POP', 'VAR_SAMP'):
if self.postgres_version[0:2] < [8,2]:
if self.postgres_version[0:2] < (8,2):
raise NotImplementedError('PostgreSQL does not support %s prior to version 8.2. Please upgrade your version of PostgreSQL.' % aggregate.sql_function)

if aggregate.sql_function in ('STDDEV_POP', 'VAR_POP'):
if self.postgres_version[0:2] == [8,2]:
if self.postgres_version[0:2] == (8,2):
if self.postgres_version[2] is None or self.postgres_version[2] <= 4:
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 comments on commit 4f9fd44

Please sign in to comment.