diff options
-rw-r--r-- | synapse/storage/state.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/synapse/storage/state.py b/synapse/storage/state.py index 71db16d0e5..e94c8fcd18 100644 --- a/synapse/storage/state.py +++ b/synapse/storage/state.py @@ -60,14 +60,19 @@ class StateStore(SQLBaseStore): res = {} for group in groups: - state_ids = self._simple_select_onecol_txn( - txn, - table="state_groups_state", - keyvalues={"state_group": group}, - retcol="event_id", + sql = ( + "SELECT internal_metadata, json, r.event_id " + "FROM event_json as e " + "INNER JOIN state_groups_state as s " + "ON e.event_id = s.event_id " + "LEFT JOIN redactions as r ON e.event_id = r.redacts " + "WHERE s.state_group = ?" ) - state = self._get_events_txn(txn, state_ids) + txn.execute(sql, (group,)) + rows = txn.fetchall() + + state = [self._get_event_from_row_txn(txn, *r) for r in rows] res[group] = state |