|
@@ -9,7 +9,7 @@ class DatabaseOperations(BaseDatabaseOperations):
|
|
|
super(DatabaseOperations, self).__init__(connection)
|
|
|
|
|
|
def date_extract_sql(self, lookup_type, field_name):
|
|
|
-
|
|
|
+
|
|
|
if lookup_type == 'week_day':
|
|
|
|
|
|
return "EXTRACT('dow' FROM %s) + 1" % field_name
|
|
@@ -34,7 +34,7 @@ class DatabaseOperations(BaseDatabaseOperations):
|
|
|
return '(%s)' % conn.join([sql, 'interval \'%s\'' % mods])
|
|
|
|
|
|
def date_trunc_sql(self, lookup_type, field_name):
|
|
|
-
|
|
|
+
|
|
|
return "DATE_TRUNC('%s', %s)" % (lookup_type, field_name)
|
|
|
|
|
|
def datetime_extract_sql(self, lookup_type, field_name, tzname):
|
|
@@ -43,7 +43,7 @@ class DatabaseOperations(BaseDatabaseOperations):
|
|
|
params = [tzname]
|
|
|
else:
|
|
|
params = []
|
|
|
-
|
|
|
+
|
|
|
if lookup_type == 'week_day':
|
|
|
|
|
|
sql = "EXTRACT('dow' FROM %s) + 1" % field_name
|
|
@@ -57,7 +57,7 @@ class DatabaseOperations(BaseDatabaseOperations):
|
|
|
params = [tzname]
|
|
|
else:
|
|
|
params = []
|
|
|
-
|
|
|
+
|
|
|
sql = "DATE_TRUNC('%s', %s)" % (lookup_type, field_name)
|
|
|
return sql, params
|
|
|
|
|
@@ -178,17 +178,6 @@ class DatabaseOperations(BaseDatabaseOperations):
|
|
|
def prep_for_iexact_query(self, x):
|
|
|
return x
|
|
|
|
|
|
- def check_aggregate_support(self, aggregate):
|
|
|
- """Check that the backend fully supports the provided aggregate.
|
|
|
-
|
|
|
- The implementation of population statistics (STDDEV_POP and VAR_POP)
|
|
|
- under Postgres 8.2 - 8.2.4 is known to be faulty. Raise
|
|
|
- NotImplementedError if this is the database in use.
|
|
|
- """
|
|
|
- if aggregate.sql_function in ('STDDEV_POP', 'VAR_POP'):
|
|
|
- if 80200 <= self.connection.pg_version <= 80204:
|
|
|
- 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)
|
|
|
-
|
|
|
def max_name_length(self):
|
|
|
"""
|
|
|
Returns the maximum length of an identifier.
|