-
Summary
I’m not able to see or add in Users menu of the Console. This happens since migration to postgresql. -
Steps to reproduce
Mattermost Server: 10.11.19
Postgresql: 16.13-0ubuntu0.24.04.1
OS: Ubuntu 24.04.4 -
Expected behavior
Be able to list and add users -
Observed behavior
While opening the Users Menu on the console I observed this error on mattermost.log:
{
“caller”: “web/context.go:122”,
“err_where”: “GetUsersForReporting”,
“error”: “GetUsersForReporting: Failed to fetch user report., failed to get users for reporting: pq: relation "poststats" does not exist”,
“http_code”: 500,
“ip_addr”: “10.29.88.6”,
“level”: “error”,
“method”: “GET”,
“msg”: “Failed to fetch user report.”,
“path”: “/api/v4/reports/users”,
“request_id”: “dwxnjachbf8xze3q7d991pgqbc”,
“timestamp”: “2026-07-16 12:55:38.751 -04:00”,
“user_id”: “I changhed this value”
}
On same server, this can be related if UI console needs ‘local mode’ as mmctl:
$ ./mmctl user list
Warning: Unable to retrieve credentials, assuming --local mode
There are 0 users
Error: failed to create client: socket file "/var/tmp/mattermost_local.socket" doesn't exist, please check the server configuration for local mode
Should I enable it?
Hi @RRCJF, enabling local mode would only allow mmctl to connect through the local socket and won’t resolve the System Console error; the missing poststats table suggests the PostgreSQL schema migration was incomplete, so please back up the database and review the PostgreSQL migration guide, including how the schema and migrations were created.
Hi John, thank you for your response. In fact I got an error during the migration that aparently completed ‘well’. I saw that you already responded, at least to a topic about this error that I’m not sure if its related to the problem:
2026-07-09T18:19:36.450477-04:00 ERROR PostgreSQL Database error 54000: string is too long for tsvector (1092456 bytes, max 1048575 bytes)
QUERY: CREATE INDEX idx_16510_idx_fileinfo_content_txt ON mattermost.fileinfo USING gin(to_tsvector('simple', content));
I used pg_loader for migration, I did it in 2 Servers, one use schema mattermost (and search_path) other public. The problem in Users menu is the same in both VMs (doesn’t load any user and I cannot create one), but users table has all users and the chat works aparently well. I changed json types to jsonb after the migration.
Analizing the log and double-check on DB I confirmed the poststats didn’t exist.
- Solution
With AI help I create the materialized view, and I would appreciate if someone confirm if the solution is correct (apparently it is working well in test for public schema):
CREATE MATERIALIZED VIEW IF NOT EXISTS poststats AS SELECT userid, to_timestamp(createat/1000)::date as day, COUNT(*) as numposts, MAX(CreateAt) as lastpostdate FROM posts GROUP BY userid, day;
Thank you.
However we can list the users with the change that I here posted before, maybe is also a good information to report that pgloader didn’t migrate the column teammembers.schemeguest with the right type. It was ‘smallint’ and I believe it should be ‘boolean’.
The following fix allow me to be able to finally create users:
ALTER TABLE teammembers ALTER COLUMN schemeguest TYPE boolean USING (schemeguest::integer::boolean);