summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-06-09 13:01:23 +0100
committerErik Johnston <erik@matrix.org>2017-06-09 13:01:23 +0100
commit935e588799cac738d808faa8024bcba5fd5c6c06 (patch)
tree4aa8a0045d1f080aab88c7509ee9131998f6cd3f
parentFix replication (diff)
downloadsynapse-935e588799cac738d808faa8024bcba5fd5c6c06.tar.xz
Tweak SQL
-rw-r--r--synapse/storage/roommember.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/synapse/storage/roommember.py b/synapse/storage/roommember.py
index 447c6364e7..e38bbd22a3 100644
--- a/synapse/storage/roommember.py
+++ b/synapse/storage/roommember.py
@@ -507,9 +507,12 @@ class RoomMemberStore(SQLBaseStore):
             raise Exception("Invalid host name")
 
         sql = """
-            SELECT state_key FROM current_state_events
-            INNER JOIN room_memberships USING (room_id, event_id)
-            WHERE membership = 'join' AND room_id = ? AND state_key LIKE ?
+            SELECT state_key FROM current_state_events AS c
+            INNER JOIN room_memberships USING (event_id)
+            WHERE membership = 'join'
+                AND type = 'm.room.member'
+                AND c.room_id = ?
+                AND state_key LIKE ?
             LIMIT 1
         """