summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql_psycopg2/operations.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/db/backends/postgresql_psycopg2/operations.py')
-rw-r--r--django/db/backends/postgresql_psycopg2/operations.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/django/db/backends/postgresql_psycopg2/operations.py b/django/db/backends/postgresql_psycopg2/operations.py
index 46b464b551..e93a15512b 100644
--- a/django/db/backends/postgresql_psycopg2/operations.py
+++ b/django/db/backends/postgresql_psycopg2/operations.py
@@ -193,7 +193,9 @@ class DatabaseOperations(BaseDatabaseOperations):
def last_executed_query(self, cursor, sql, params):
# http://initd.org/psycopg/docs/cursor.html#cursor.query
# The query attribute is a Psycopg extension to the DB API 2.0.
- return cursor.query
+ if cursor.query is not None:
+ return cursor.query.decode('utf-8')
+ return None
def return_insert_id(self):
return "RETURNING %s", ()