diff options
author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2009-04-12 02:00:58 +0000 |
---|---|---|
committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2009-04-12 02:00:58 +0000 |
commit | a584a6b40f8f685f5809eb77de2c7be0b150aeda (patch) | |
tree | 0930de38039daff5b5358879f73dfb2356ad83a2 /django/db/backends/postgresql/operations.py | |
parent | 1aa0d1b4a696c51c97a4b2294488e51354350678 (diff) | |
download | django-a584a6b40f8f685f5809eb77de2c7be0b150aeda.tar.gz |
Fixed #10071 -- Changed some internal database data representations.
We now pass numbers used in data queries as actualy numbers (integers) to the
database backends, rather than string forms. This is easier for some of the
less flexible backeds.
Based on a patch from Leo Soto and Ramiro Morales.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10530 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/backends/postgresql/operations.py')
-rw-r--r-- | django/db/backends/postgresql/operations.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/django/db/backends/postgresql/operations.py b/django/db/backends/postgresql/operations.py index 14bd976d8b..35824609b2 100644 --- a/django/db/backends/postgresql/operations.py +++ b/django/db/backends/postgresql/operations.py @@ -27,9 +27,8 @@ class DatabaseOperations(BaseDatabaseOperations): def date_extract_sql(self, lookup_type, field_name): # http://www.postgresql.org/docs/8.0/static/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT if lookup_type == 'week_day': - # Using EXTRACT(), PostgreSQL days are indexed as Sunday=0, Saturday=6. - # If we instead us TO_CHAR, they're indexed with Sunday=1, Saturday=7 - return "TO_CHAR(%s, 'D')" % field_name + # For consistency across backends, we return Sunday=1, Saturday=7. + return "EXTRACT('dow' FROM %s) + 1" % field_name else: return "EXTRACT('%s' FROM %s)" % (lookup_type, field_name) |