Reputation: 31
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.
Upvotes: 3
Views: 12471
Reputation: 37318
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
Upvotes: 1
Reputation: 31
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.
Upvotes: 0