[PostgreSQL] ERROR: must be owner of extension plpgsql

Tadashi Shigeoka ·  Thu, September 13, 2012

During a database migration from PostgreSQL 8.0.4 to 9.1.5, when I imported data from pg_dump, the following error occurred:

CREATE EXTENSION
ERROR:  must be owner of extension plpgsql

WARNING:  no privileges could be revoked for "public"
WARNING:  no privileges were granted for "public"

I resolved this by adding “superuser” privileges to the user operating the database.

■ Add superuser privileges

postgres=# \\du
                                         ロール一覧
 ロール名 |                                 属性                                 | メンバー 
----------+----------------------------------------------------------------------+----------
 newuser   | DBを作成できる                                                       | {}
 postgres | スーパーユーザ, ロールを作成できる, DBを作成できる, レプリケーション | {}

postgres=# ALTER USER newuser CREATEUSER ;
ALTER ROLE

postgres=# \\du
                                         ロール一覧
 ロール名 |                                 属性                                 | メンバー 
----------+----------------------------------------------------------------------+----------
 newuser   | スーパーユーザ, DBを作成できる                                       | {}
 postgres | スーパーユーザ, ロールを作成できる, DBを作成できる, レプリケーション | {}

That’s all.

【Reference】

トリガーやファンクションのリストアが失敗していた。 - マンドクセェメモ

CREATE EXTENSION

That’s all from the Gemba.