Seeing error "Must be owner of extension plpgsql" during a Postgres database restore.

Document ID : KB000004307
Last Modified Date : 15/10/2018
Show Technical Document Details
Issue:

The following message appears in the console when executing "dbrestore-postgres.bat" or "dbrestore-postgres.sh":

pg_restore: [archiver (db)] Error while PROCESSING TOC: 

pg_restore: [archiver (db)] Error from TOC entry nnnnn; 0 0 COMMENT EXTENSION plpgsql 
pg_restore: [archiver (db)] could not execute query: ERROR: must be owner of extension plpgsql 
Command was: COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';

Environment:
All supported APM Releases.
Cause:

The message means that the command "COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'" had the error. In most cases, this message can be ignored. 
During the restore, it tries restoring this comment. However, the restore user was not owner of the extension plpgsql, causing the error.
The comment of extension plpgsql already exists, there is no problem as a result.

Resolution:

This is a typical scenario and these messages can be safely ignored in most cases. Note that the restore process continues and finishes normally.