diff --git a/synapse/storage/user_directory.py b/synapse/storage/user_directory.py
index b848d9db0063eb14eb42beddebe898818dd8a9ed..0e6619222c8d6dbb8d394bfbe3e9f99750d3ec85 100644
--- a/synapse/storage/user_directory.py
+++ b/synapse/storage/user_directory.py
@@ -266,7 +266,7 @@ class UserDirectoryStore(SQLBaseStore):
         in the given room_id
         """
         user_ids_share_pub = yield self._simple_select_onecol(
-            table="publicly_visible_users",
+            table="users_in_public_rooms",
             keyvalues={"room_id": room_id},
             retcol="user_id",
             desc="get_users_in_dir_due_to_room",