summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2020-06-11 18:25:25 +0100
committerBrendan Abolivier <babolivier@matrix.org>2020-06-11 18:25:25 +0100
commit803291728cad3c29e7800d0f92f79eea73a169ef (patch)
treedabb26f835bd28348859f523a96ed47a61ec98b7
parentFix schema update (diff)
downloadsynapse-803291728cad3c29e7800d0f92f79eea73a169ef.tar.xz
Fix SQL
-rw-r--r--synapse/storage/data_stores/main/event_push_actions.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/synapse/storage/data_stores/main/event_push_actions.py b/synapse/storage/data_stores/main/event_push_actions.py
index af0ab6cbc1..7cd3ae6ae6 100644
--- a/synapse/storage/data_stores/main/event_push_actions.py
+++ b/synapse/storage/data_stores/main/event_push_actions.py
@@ -843,7 +843,7 @@ class EventPushActionsStore(EventPushActionsWorkerStore):
                 upd.stream_ordering,
                 old.user_id
             FROM (
-                SELECT user_id, room_id, count(*) as unread_count,
+                SELECT user_id, room_id, count(*) as %s,
                     max(stream_ordering) as stream_ordering
                 FROM event_push_actions
                 WHERE ? <= stream_ordering AND stream_ordering < ?
@@ -856,14 +856,14 @@ class EventPushActionsStore(EventPushActionsWorkerStore):
 
         # First get the count of unread messages.
         txn.execute(
-            sql % ("unread_count", "unread_count", ""),
+            sql % ("unread_count", "unread_count", "unread_count", ""),
             (old_rotate_stream_ordering, rotate_to_stream_ordering),
         )
         rows = txn.fetchall()
 
         # Then get the count of notifications.
         txn.execute(
-            sql % ("notify_count", "notify_count", "notif = 1"),
+            sql % ("notif_count", "notif_count", "notif_count", "AND notif = 1"),
             (old_rotate_stream_ordering, rotate_to_stream_ordering),
         )
         notif_rows = txn.fetchall()