summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-02-26 12:12:51 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2020-02-26 12:12:51 +0000
commitdc68d858174cc0a2c178e9e79d699691c5b20cc0 (patch)
treee40975149af9f7949fee5e006f2c60fc7d1dbcf1 /synapse
parentMerge pull request #6152 from matrix-org/erikj/fix_room_list (diff)
parentMerge pull request #6148 from matrix-org/erikj/find_next_generated (diff)
downloadsynapse-dc68d858174cc0a2c178e9e79d699691c5b20cc0.tar.xz
Merge pull request #6148 from matrix-org/erikj/find_next_generated
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/registration.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/synapse/storage/registration.py b/synapse/storage/registration.py
index 508c4b043b..2a2b48f404 100644
--- a/synapse/storage/registration.py
+++ b/synapse/storage/registration.py
@@ -515,7 +515,9 @@ class RegistrationWorkerStore(SQLBaseStore):
         """
 
         def _find_next_generated_user_id(txn):
-            txn.execute("SELECT name FROM users")
+            # We bound between '@1' and '@a' to avoid pulling the entire table
+            # out.
+            txn.execute("SELECT name FROM users WHERE '@1' <= name AND name < '@a'")
 
             regex = re.compile(r"^@(\d+):")