user11810894
user11810894

Reputation:

createdb / pg_restore has error: must be owner of extension

I get this error:

pg_restore: [archiver (db)] Error while PROCESSING TOC: 
pg_restore: [archiver (db)] Error from TOC entry 4034; 0 0 COMMENT EXTENSION pg_trgm  
pg_restore: [archiver (db)] could not execute query: ERROR: 
must be owner of extension pg_trgm
Command was: COMMENT ON EXTENSION pg_trgm IS 'text similarity measurement and index searching based on trigrams';

when I run this command:

PGPASSWORD="$db_pwd" createdb -U "$db_user" -h "$db_host" -p 5432 --no-password -e "$db_name"

how can I fix? I assume the right thing to do is make myself owner of the pg_trgm extension, but how?

Upvotes: 1

Views: 4159

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 247270

It is not the createdb command that causes this error, but a pg_restore.

This means that you restored a dump from a database with the pg_trgm extension as a non-superuser.

The extension itself is restored as

CREATE EXTENSION IF NOT EXISTS pg_trgm;

so this will not result in an error if the extension already exists, but the following

COMMENT ON EXTENSION pg_trgm IS '...';

will cause an error for non-superusers.

You can safely ignore this error.

Upvotes: 4

Related Questions