diff options
author | Claude Paroz <claude@2xlibre.net> | 2012-06-13 11:36:27 +0200 |
---|---|---|
committer | Claude Paroz <claude@2xlibre.net> | 2012-06-13 12:04:46 +0200 |
commit | e9ef9776d186a3379cdbf47a73b14e89b74d0926 (patch) | |
tree | aeda39158b9b1fc8751e74d806e81159d0f3002c /django/db/backends/postgresql_psycopg2/operations.py | |
parent | a7ef802fa4b48d0c159940d405d83522adb9d4b3 (diff) | |
download | django-e9ef9776d186a3379cdbf47a73b14e89b74d0926.tar.gz |
Fixed #18461 -- Ensured that last_executed_query returns Unicode
Thanks Anssi Kääriäinen for the review.
Diffstat (limited to 'django/db/backends/postgresql_psycopg2/operations.py')
-rw-r--r-- | django/db/backends/postgresql_psycopg2/operations.py | 4 |
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", () |