RHV: upgrade from 4.2.4 to 4.2.5 fails with "ERROR: must be owner of extension plpgsql"

Solution Unverified - Updated -

Environment

  • Red Hat Virtualization 4.2
    • Upgrade from 4.2.4 to 4.2.5.

Issue

  • Upgrade from 4.2.4 to 4.2.5 failed.
  • Upgrade from 4.2.4 to 4.2.5 initially failed due to other reason, and then automatic roll-back also failed when restoring engine and ovirt_engine_history databases.
  • The following error is shown:
ERROR:  must be owner of extension plpgsql

Resolution

A workaround exists but it requires manual database manipulation. Please contact Red Hat Support and mention this article.

The problem is currently being investigated in Bugzilla 1611617 - During 4.2.4 to 4.2.5 upgrade: "ERROR: must be owner of extension plpgsql during Restoring DWH database ovirt_engine_history and engine".

Root Cause

By default Postgres creates new databases with the extension plpgsql. However, to manually create this extension on some databases, owning the database is not enough and actual admin permissions are required.

When engine-backup restores a database, it always uses only the credentials of the engine database user, not postgres, thus (by default) has no admin privileges at this point, which makes the extrension creation fail.

Diagnostic Steps

pg_restore returns the following errors:

pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 7309; 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';

pg_restore: [archiver (db)] Error from TOC entry 2; 3079 32579416 EXTENSION uuid-ossp 
pg_restore: [archiver (db)] could not execute query: ERROR:  permission denied to create extension "uuid-ossp"
HINT:  Must be superuser to create this extension.
    Command was: CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA public;

pg_restore: [archiver (db)] Error from TOC entry 7310; 0 0 COMMENT EXTENSION "uuid-ossp" 
pg_restore: [archiver (db)] could not execute query: ERROR:  extension "uuid-ossp" does not exist
    Command was: COMMENT ON EXTENSION "uuid-ossp" IS 'generate universally unique identifiers (UUIDs)';

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments