summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2018-03-12 00:27:06 +0000
committerMatthew Hodgson <matthew@matrix.org>2018-03-12 00:27:06 +0000
commit97c0496cfa89b037d89fccd05dd03442b80e07fc (patch)
tree654a59e55b3165011549f511896d9950d345c60d /synapse/storage
parenttypos (diff)
downloadsynapse-97c0496cfa89b037d89fccd05dd03442b80e07fc.tar.xz
fix sqlite where clause
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/state.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/synapse/storage/state.py b/synapse/storage/state.py
index 0238200286..b796d3c995 100644
--- a/synapse/storage/state.py
+++ b/synapse/storage/state.py
@@ -277,13 +277,14 @@ class StateGroupWorkerStore(SQLBaseStore):
                         results[group][key] = event_id
         else:
             if types is not None:
-                where_clause = "AND (%s)" % (
+                where_clause = "AND (%s" % (
                     " OR ".join(["(type = ? AND state_key = ?)"] * len(types)),
                 )
                 if include_other_types:
-                    where_clause += " AND (%s)" % (
+                    where_clause += " OR (%s)" % (
                         " AND ".join(["type <> ?"] * len(types)),
                     )
+                where_clause += ")"
             else:
                 where_clause = ""