Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

must be owner of extension plpgsql error when executing pg_restore

i was trying to restore database on amazon rds.. i am getting error message like:

ERROR:  must be owner of extension plpgsql CREATE EXTENSION
ERROR:  must be owner of extension dblink  CREATE EXTENSION
ERROR:  must be owner of extension pgcrypto

Any idea how to solve this issue ?.

like image 981
Shamseer PC Avatar asked Jul 09 '17 05:07

Shamseer PC


People also ask

Could not execute query error must be owner of extension Plpgsql command was comment on extension Plpgsql is PL pgSQL procedural language ';?

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.

What is $$ in Plpgsql?

In PostgreSQL, the dollar-quoted string constants ($$) is used in user-defined functions and stored procedures. In PostgreSQL, you use single quotes for a string constant like this: select 'String constant';

What is Pg_restore in Postgres?

Description. pg_restore is a utility for restoring a PostgreSQL database from an archive created by pg_dump in one of the non-plain-text formats. It will issue the commands necessary to reconstruct the database to the state it was in at the time it was saved.

How do you change role in PostgreSQL?

Syntax: ALTER ROLE role_name [WITH] option; The following functions are available with ALTER ROLE statement: SUPERUSER | NOSUPERUSER – It is used to determine if the role is a superuser. VALID UNTIL 'timestamp' – It is used to specify the expiry date and time of a role's password.


1 Answers

I believe both of those extensions are supported by RDS. See:

$SHOW rds.extensions;

Retrieved from this link

As for enabling the syntax should be along the lines of

#enable_extension "dblink";

As Craig Ringer mentioned rds_super isn't a real superuser. So, you can't create the extensions. However, you should be able to enable them.

As in this example

So, you can ignore the errors, but need to manually enable whatever extensions you need. Also I think pl/pgsql may be already there. Try

$\dx
like image 73
Francisco1844 Avatar answered Sep 18 '22 15:09

Francisco1844