summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql/operations.py
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-02-23 09:15:35 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-02-23 09:15:35 +0000
commit6482f1f8877638493810d2740c56e1b62519c8bd (patch)
tree968146ac926cca1fdf5f5f979cf7907fb9b46fc8 /django/db/backends/postgresql/operations.py
parent32402773f10160a5cf3252a325c98f5e74fb7ceb (diff)
downloaddjango-6482f1f8877638493810d2740c56e1b62519c8bd.tar.gz
Fixed #708 -- Fixed searching within IP fields on PostgreSQL.
Based on a patch from Matt McClanahan. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7151 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/backends/postgresql/operations.py')
-rw-r--r--django/db/backends/postgresql/operations.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/django/db/backends/postgresql/operations.py b/django/db/backends/postgresql/operations.py
index 20392b238e..2c40b11607 100644
--- a/django/db/backends/postgresql/operations.py
+++ b/django/db/backends/postgresql/operations.py
@@ -27,6 +27,11 @@ class DatabaseOperations(BaseDatabaseOperations):
def deferrable_sql(self):
return " DEFERRABLE INITIALLY DEFERRED"
+ def field_cast_sql(self, db_type):
+ if db_type == 'inet':
+ return 'CAST(%s AS TEXT)'
+ return '%s'
+
def last_insert_id(self, cursor, table_name, pk_name):
cursor.execute("SELECT CURRVAL('\"%s_%s_seq\"')" % (table_name, pk_name))
return cursor.fetchone()[0]