During restore of gitlab-7.4.3-omnibus: "ERROR: must be owner of extension plpgsql"

Created by: ghost

I'm attempting to migrate an Omnibus GitLab 7.4.3 hosted on CentOS6 to another CentOS6 machine, using backup and restore. The source instance runs "gitlab-rake gitlab:backup:create" every night, and I copied the resulting tarball to the freshly installed destination instance, where I then tried:

gitlab-rake gitlab:backup:restore BACKUP=1415689405

This results in one error, and several warnings. The error comes right at the start:

Unpacking backup ... done
Restoring database ...
Restoring PostgreSQL database gitlabhq_production ... SET
SET
SET
SET
SET
CREATE EXTENSION
psql:/var/opt/gitlab/backups/db/database.sql:22: ERROR:  must be owner of extension plpgsql

but this does not seem immediately fatal, it continues with printing database statements (why are these echo'd anyway?):

SET
CREATE SEQUENCE
ALTER TABLE
[...]

This goes on for some time, and after a while it prints these warnings:

[...]
ALTER TABLE
psql:/var/opt/gitlab/backups/db/database.sql:15761: WARNING:  no privileges could be revoked for "public"
REVOKE
psql:/var/opt/gitlab/backups/db/database.sql:15762: WARNING:  no privileges could be revoked for "public"
REVOKE
psql:/var/opt/gitlab/backups/db/database.sql:15763: WARNING:  no privileges were granted for "public"
GRANT
psql:/var/opt/gitlab/backups/db/database.sql:15764: WARNING:  no privileges were granted for "public"
GRANT
[DONE]

I saw something that looked like the "must be owner" error in #6067 (closed), but that issue appears to have been closed due to a timeout, without a real resolution.

Any idea whether the restored instance will now have a correct database? The line 22 about which the error is reported just has:

COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';

while lines 15761 through 15764 are:

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM "gitlab-psql";
GRANT ALL ON SCHEMA public TO "gitlab-psql";
GRANT ALL ON SCHEMA public TO PUBLIC;