3

I am very new to postgres. One of my project is using an RDS postgres instance, the application team created a user and use that user to create the database.

I am trying to grant default privilege to the default postgres user to this application database by running the command below but I am getting an error message.

ALTER DEFAULT PRIVILEGES
FOR USER postgres
IN SCHEMA public
GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO postgres;

Error message

ERROR:  must be member of role "postgres"
SQL state: 42501

Please advise how I can grant default privilege to postgres user for the database.

1
  • issue is not reproducible in PG 11.4, can you share the PG version. Commented Jul 11, 2019 at 8:57

3 Answers 3

4

You must connect as a superuser to run this command.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you. I misunderstood my case earlier. Apparently, postgres user was the owner of the database not the app user. So I logged in as postgres and executed the command and it works.
1

If you did a pgdump to export the database, and then were getting this error on trying to import it. Use -O when creating the pgdump - https://www.postgresql.org/docs/current/app-pgdump.html

Comments

0

I misunderstood my case earlier. Apparently, postgres user was the owner of the database not the app user. So I logged in as postgres and executed the command and it works.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.