diff --git a/synapse/storage/databases/state/store.py b/synapse/storage/databases/state/store.py index 0b71f1e5d7..d09419b218 100644 --- a/synapse/storage/databases/state/store.py +++ b/synapse/storage/databases/state/store.py @@ -318,9 +318,10 @@ class StateGroupDataStore(StateBackgroundUpdateStore, SQLBaseStore): def _get_state_for_client_filtering_txn( txn: LoggingTransaction, groups: Iterable[int] ) -> Mapping[int, MutableStateMap[str]]: + sql = """ WITH RECURSIVE sgs(state_group) AS ( - VALUES(?::bigint) + VALUES(CAST(? AS bigint)) UNION ALL SELECT prev_state_group FROM state_group_edges e, sgs s WHERE s.state_group = e.state_group