diff options
author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-08-08 20:09:53 +0000 |
---|---|---|
committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-08-08 20:09:53 +0000 |
commit | 32d5c39016f7f14dfc19142d78d944d92eb9cd70 (patch) | |
tree | 6bc42a1be1835f9acd5fd38014343a1320f27685 /django/db/backends/postgresql/operations.py | |
parent | 6d4b14378639ea1e836f26f7ae1950368bc09260 (diff) | |
download | django-32d5c39016f7f14dfc19142d78d944d92eb9cd70.tar.gz |
Fixed #6523 -- Use the correct cast on field types for PostgreSQL when
searching within a field column (e.g. "like", "contains", etc). Required for
PostgreSQL 8.3. Thanks to Dan Watson for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8242 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/backends/postgresql/operations.py')
-rw-r--r-- | django/db/backends/postgresql/operations.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/django/db/backends/postgresql/operations.py b/django/db/backends/postgresql/operations.py index ba6e3235c2..de7b5a9520 100644 --- a/django/db/backends/postgresql/operations.py +++ b/django/db/backends/postgresql/operations.py @@ -35,6 +35,12 @@ class DatabaseOperations(BaseDatabaseOperations): def deferrable_sql(self): return " DEFERRABLE INITIALLY DEFERRED" + def lookup_cast(self, lookup_type): + if lookup_type in ('iexact', 'contains', 'icontains', 'startswith', 'istartswith', + 'endswith', 'iendswith'): + return "%s::text" + return "%s" + def field_cast_sql(self, db_type): if db_type == 'inet': return 'HOST(%s)' |