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

book

Article ID: 4307

calendar_today

Updated On:

Products

APP PERF MANAGEMENT CA Application Performance Management Agent (APM / Wily / Introscope) CUSTOMER EXPERIENCE MANAGER INTROSCOPE

Issue/Introduction

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';

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.

Environment

All supported APM Releases.

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.

If the error is still a concern or hinders restoration, please see articles such as https://stackoverflow.com/questions/10169203/postgresql-9-1-pg-restore-error-regarding-plpgsql for additional steps