summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@arasphere.net>2018-01-17 16:27:54 +0000
committerGitHub <noreply@github.com>2018-01-17 16:27:54 +0000
commit06db5c4b76a9d9c6d87fca6e1325d192d746b8dd (patch)
treeb97544bd6d38b551840729a503d5c3ec43984fd1
parentMerge pull request #2802 from matrix-org/rav/clean_up_resolve_events (diff)
parentfix SQL when searching all users (diff)
downloadsynapse-06db5c4b76a9d9c6d87fca6e1325d192d746b8dd.tar.xz
Merge pull request #2803 from matrix-org/matthew/fix-userdir-sql
fix SQL when searching all users
-rw-r--r--synapse/storage/user_directory.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/synapse/storage/user_directory.py b/synapse/storage/user_directory.py
index c9bff408ef..f150ef0103 100644
--- a/synapse/storage/user_directory.py
+++ b/synapse/storage/user_directory.py
@@ -641,8 +641,13 @@ class UserDirectoryStore(SQLBaseStore):
         """
 
         if self.hs.config.user_directory_search_all_users:
-            join_clause = ""
-            where_clause = "?<>''"  # naughty hack to keep the same number of binds
+            # dummy to keep the number of binds & aliases the same
+            join_clause = """
+                LEFT JOIN (
+                    SELECT NULL as user_id WHERE NULL = ?
+                ) AS s USING (user_id)"
+            """
+            where_clause = ""
         else:
             join_clause = """
                 LEFT JOIN users_in_public_rooms AS p USING (user_id)