From 658f1e81a7ea29acf30bbf8f61ffec2beff24639 Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Wed, 21 Sep 2016 21:53:48 -0400 Subject: [PATCH] Removed unnecessary casting when using builtin lookups on PostgreSQL. --- django/db/backends/postgresql/operations.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/django/db/backends/postgresql/operations.py b/django/db/backends/postgresql/operations.py index c32ca040e79..a30d24a0ebd 100644 --- a/django/db/backends/postgresql/operations.py +++ b/django/db/backends/postgresql/operations.py @@ -83,6 +83,8 @@ class DatabaseOperations(BaseDatabaseOperations): 'istartswith', 'endswith', 'iendswith', 'regex', 'iregex'): if internal_type in ('IPAddressField', 'GenericIPAddressField'): lookup = "HOST(%s)" + elif internal_type in ('CharField', 'TextField'): + lookup = '%s' else: lookup = "%s::text"