diff --git a/synapse/storage/room.py b/synapse/storage/room.py index 198612cf1c69..9cfa19d8dc70 100644 --- a/synapse/storage/room.py +++ b/synapse/storage/room.py @@ -246,7 +246,7 @@ def _background_insert_retention(self, progress, batch_size): def _background_insert_retention_txn(txn): txn.execute( """ - SELECT r.room_id, e.json FROM rooms + SELECT rooms.room_id, events.json FROM rooms LEFT OUTER JOIN current_state_events AS state ON ( rooms.room_id = state.room_id AND state.type = '%s'