Problem
After refreshing an environment, some customers may notice that the System Console → User Management → Users page does not display any users.
Other user-related functionality continues to work normally, such as:
- Searching for users when starting a DM
- Adding users to a team or channel
- Searching for channels and posts
However, the System Console Users page remains blank as below-
In the server logs, you may also see a 500 error for the /api/v4/reports/users endpoint, similar to:
{"level":"error","msg":"Failed to fetch user report.","error":"GetUsersForReporting: failed to get users for reporting: pq: materialized view \"poststats\" has not been populated"}
Cause
This behavior can occur if the Postgres materialized view poststats is not populated after the database restore.
The poststats view is used by Mattermost for reporting data, including the Users page in the System Console. If the view is empty (ispopulated = false), the reports endpoint will return errors, and the Users list cannot load.
Solution
To resolve the issue, you need to refresh the poststats materialized view in the Postgres database:
- Connect to your Mattermost Postgres database.
Run the following command to refresh the view:
REFRESH MATERIALIZED VIEW public.poststats;
Verify that the view is now populated:
SELECT schemaname, matviewname, ispopulated FROM pg_matviews WHERE matviewname IN ('poststats');- If
ispopulated=true, the view is successfully refreshed.
- If
- Retry accessing System Console → User Management → Users. The user list should now load as expected.
Comments
Article is closed for comments.