summary refs log tree commit diff
path: root/synapse/storage/engines
diff options
context:
space:
mode:
authorAmber Brown <hawkowl@atleastfornow.net>2018-08-31 00:19:58 +1000
committerGitHub <noreply@github.com>2018-08-31 00:19:58 +1000
commit14e4d4f4bf894f4e70118e03f4f4575e1eb6dab6 (patch)
tree1c7ba21ab2ebe5dbf4c7c15b0b89376fda865c31 /synapse/storage/engines
parentMerge pull request #3764 from matrix-org/rav/close_db_conn_after_init (diff)
downloadsynapse-14e4d4f4bf894f4e70118e03f4f4575e1eb6dab6.tar.xz
Port storage/ to Python 3 (#3725)
Diffstat (limited to 'synapse/storage/engines')
-rw-r--r--synapse/storage/engines/postgres.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/synapse/storage/engines/postgres.py b/synapse/storage/engines/postgres.py
index 8a0386c1a4..42225f8a2a 100644
--- a/synapse/storage/engines/postgres.py
+++ b/synapse/storage/engines/postgres.py
@@ -41,13 +41,18 @@ class PostgresEngine(object):
         db_conn.set_isolation_level(
             self.module.extensions.ISOLATION_LEVEL_REPEATABLE_READ
         )
+
+        # Set the bytea output to escape, vs the default of hex
+        cursor = db_conn.cursor()
+        cursor.execute("SET bytea_output TO escape")
+
         # Asynchronous commit, don't wait for the server to call fsync before
         # ending the transaction.
         # https://www.postgresql.org/docs/current/static/wal-async-commit.html
         if not self.synchronous_commit:
-            cursor = db_conn.cursor()
             cursor.execute("SET synchronous_commit TO OFF")
-            cursor.close()
+
+        cursor.close()
 
     def is_deadlock(self, error):
         if isinstance(error, self.module.DatabaseError):