From 339500d0673086879c257ccfc2060673961952c9 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Wed, 21 Aug 2024 22:56:25 -0500 Subject: [PATCH] Fix sub-query selecting multiple rows --- synapse/storage/databases/main/events_bg_updates.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/synapse/storage/databases/main/events_bg_updates.py b/synapse/storage/databases/main/events_bg_updates.py index 253c324f9a..6695a9578f 100644 --- a/synapse/storage/databases/main/events_bg_updates.py +++ b/synapse/storage/databases/main/events_bg_updates.py @@ -1998,7 +1998,7 @@ class EventsBackgroundUpdatesStore(StreamWorkerStore, StateDeltasStore, SQLBaseS {("," + ", ".join(insert_keys)) if insert_keys else ""}) VALUES ( ?, ?, ?, ?, ?, - (SELECT forgotten FROM room_memberships WHERE room_id = ? AND user_id = ?), + (SELECT forgotten FROM room_memberships WHERE event_id = ?), ? {("," + ", ".join("?" for _ in insert_values)) if insert_values else ""} ) @@ -2012,8 +2012,7 @@ class EventsBackgroundUpdatesStore(StreamWorkerStore, StateDeltasStore, SQLBaseS sender, membership_event_id, membership, - room_id, - user_id, + membership_event_id, membership_event_stream_ordering, ] + list(insert_values),