summary refs log tree commit diff
path: root/synapse/storage/engines/postgres.py
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-02-26 12:36:21 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2020-02-26 12:36:21 +0000
commit22fc7597f7b93f285d4a691372e30068db165026 (patch)
treedf52a256fd8f79795d856f60b3190f6844da4b38 /synapse/storage/engines/postgres.py
parentMerge pull request #6191 from matrix-org/rav/fix_packaging (diff)
parentMerge pull request #6186 from matrix-org/erikj/disable_sql_bytes (diff)
downloadsynapse-22fc7597f7b93f285d4a691372e30068db165026.tar.xz
Merge pull request #6186 from matrix-org/erikj/disable_sql_bytes
Diffstat (limited to 'synapse/storage/engines/postgres.py')
-rw-r--r--synapse/storage/engines/postgres.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/synapse/storage/engines/postgres.py b/synapse/storage/engines/postgres.py

index 601617b21e..d670286fa5 100644 --- a/synapse/storage/engines/postgres.py +++ b/synapse/storage/engines/postgres.py
@@ -22,6 +22,13 @@ class PostgresEngine(object): def __init__(self, database_module, database_config): self.module = database_module self.module.extensions.register_type(self.module.extensions.UNICODE) + + # Disables passing `bytes` to txn.execute, c.f. #6186. If you do + # actually want to use bytes than wrap it in `bytearray`. + def _disable_bytes_adapter(_): + raise Exception("Passing bytes to DB is disabled.") + + self.module.extensions.register_adapter(bytes, _disable_bytes_adapter) self.synchronous_commit = database_config.get("synchronous_commit", True) self._version = None # unknown as yet