Mattermost restore fails for Gitlab 18.5.0-ce.0 Omnibus
Hi,
I moved Gitlab 18.5.0-ce.0 Omnibus from Ubuntu 20.04 to an other server running Ubuntu 24.04. All worked like a charm excepted for Mattermost restore.
The backup / restore process followed : https://docs.gitlab.com/integration/mattermost/#back-up-gitlab-mattermost
When i try to restore the db SQL file i am getting many of the following errors :
ERROR: must be owner of schema public
ERROR: permission denied for schema public
ERROR: type "public.channel_bookmark_type" does not exist
ERROR: permission denied for schema public
ERROR: type "public.channel_type" does not exist
ERROR: permission denied for schema public
So checking the PostreSQL version 16.10. PostgreSQL 16 introduced a change to the rules around role permissions. And so i applied the fix given here : https://forum.mattermost.com/t/pq-permission-denied-for-schema-public/14273
GRANT ALL ON DATABASE mattermost_production TO gitlab_mattermost;
ALTER DATABASE mattermost_production OWNER TO gitlab_mattermost;
GRANT USAGE, CREATE ON SCHEMA PUBLIC TO gitlab_mattermost;
Then i tried again to restore. For now i am getting the following error :
sudo -u mattermost sh -c "zcat mattermost_dbdump_2025-10-21.sql.gz | /opt/gitlab/embedded/bin/psql -U gitlab_mattermost -h /var/opt/gitlab/postgresql -p 5432 mattermost_production"
SET
SET
SET
SET
SET
set_config
------------
(1 row)
SET
SET
SET
SET
ERROR: must be able to SET ROLE "gitlab-psql"
ERROR: type "channel_bookmark_type" already exists
ALTER TYPE
ERROR: type "channel_type" already exists
Regards
Edited by 🤖 GitLab Bot 🤖