summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql/operations.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/db/backends/postgresql/operations.py')
-rw-r--r--django/db/backends/postgresql/operations.py6
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)'