summary refs log tree commit diff
diff options
context:
space:
mode:
authorNeil Johnson <neil@fragile.org.uk>2018-03-28 11:19:45 +0100
committerNeil Johnson <neil@fragile.org.uk>2018-03-28 11:19:45 +0100
commit545001b9e4b1d6710145d3efe2117fbdf823fb38 (patch)
tree8b522d903f65166550551cb4201a7961b8d6880b
parentfix tests/storage/test_user_directory.py (diff)
downloadsynapse-545001b9e4b1d6710145d3efe2117fbdf823fb38.tar.xz
Fix search_user_dir multiple sqlite versions do different things
-rw-r--r--synapse/storage/user_directory.py4
-rw-r--r--tests/storage/test_user_directory.py2
2 files changed, 3 insertions, 3 deletions
diff --git a/synapse/storage/user_directory.py b/synapse/storage/user_directory.py
index dfdcbb3181..d6e289ffbe 100644
--- a/synapse/storage/user_directory.py
+++ b/synapse/storage/user_directory.py
@@ -667,7 +667,7 @@ class UserDirectoryStore(SQLBaseStore):
             # The array of numbers are the weights for the various part of the
             # search: (domain, _, display name, localpart)
             sql = """
-                SELECT d.user_id, display_name, avatar_url
+                SELECT d.user_id AS user_id, display_name, avatar_url
                 FROM user_directory_search
                 INNER JOIN user_directory AS d USING (user_id)
                 %s
@@ -702,7 +702,7 @@ class UserDirectoryStore(SQLBaseStore):
             search_query = _parse_query_sqlite(search_term)
 
             sql = """
-                SELECT d.user_id, display_name, avatar_url
+                SELECT d.user_id AS user_id, display_name, avatar_url
                 FROM user_directory_search
                 INNER JOIN user_directory AS d USING (user_id)
                 %s
diff --git a/tests/storage/test_user_directory.py b/tests/storage/test_user_directory.py
index 88add45217..0891308f25 100644
--- a/tests/storage/test_user_directory.py
+++ b/tests/storage/test_user_directory.py
@@ -62,7 +62,7 @@ class UserDirectoryStoreTestCase(unittest.TestCase):
         self.assertFalse(r["limited"])
         self.assertEqual(1, len(r["results"]))
         self.assertDictEqual(r["results"][0], {
-            "d.user_id": BOB,
+            "user_id": BOB,
             "display_name": "bob",
             "avatar_url": None,
         })