summary refs log tree commit diff
path: root/synapse/storage/data_stores
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2019-11-07 12:04:37 +0000
committerBrendan Abolivier <babolivier@matrix.org>2019-11-07 12:04:37 +0000
commit15a1a02e70ca18d8af9a4faaf1bb40427ea6a643 (patch)
treeafa097235693a6e21b3f1722fe291c41abdd36fd /synapse/storage/data_stores
parentChangelog (diff)
downloadsynapse-15a1a02e70ca18d8af9a4faaf1bb40427ea6a643.tar.xz
Handle lack of filter
Diffstat (limited to 'synapse/storage/data_stores')
-rw-r--r--synapse/storage/data_stores/main/stream.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/synapse/storage/data_stores/main/stream.py b/synapse/storage/data_stores/main/stream.py
index ef0b1426d1..bb70a0f38a 100644
--- a/synapse/storage/data_stores/main/stream.py
+++ b/synapse/storage/data_stores/main/stream.py
@@ -876,11 +876,9 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
         # table. We only need to use it when we're filtering on more than two labels,
         # because that's the only scenario in which we can possibly to get multiple times
         # the same event ID in the results.
-        if event_filter.labels and len(event_filter.labels) > 1:
-            select_keywords = "SELECT DISTINCT"
-
-        else:
-            select_keywords = "SELECT"
+        select_keywords = "SELECT"
+        if event_filter and event_filter.labels and len(event_filter.labels) > 1:
+            select_keywords += "DISTINCT"
 
         sql = (
             "%(select_keywords)s event_id, topological_ordering, stream_ordering"