简体   繁体   中英

Amazon RDS - Postgresql role cannot access tables

created a postgresql instance on AWS with the username ziggy. I restored a database to that instance. however I cannot even select any of the tables

select * FROM mac_childcare_parcels

gives me ERROR: permission denied for relation mac_childcare_parcels ********** Error **********

the owner of that table belongs to the postgres login.

so i tried running this: grant all privileges on all tables in schema public to ziggy but since I am not a superuser I cannot give myself privileges so that throws a permissions error. what do I have to do to get access to the tables?

this does not work either

grant select on mac_childcare_parcels to ziggy

this query returns successful but does not let the login ziggy access the tables

GRANT USAGE ON SCHEMA public TO ziggy;

First login with superuser and provide all rds superuser access to the newly created user using a command like below

GRANT rds_superuser TO ziggy;

replace rds_superuser with your rds superuser.

您还需要在 SCHEMA 上授予使用权,例如

GRANT USAGE ON SCHEMA public TO ziggy;

The superuser access is needed to run the access level queries. But as you said that access is not present then i would say copy the replica of the db which you have restored from backup and grant yourself as superuser. then provide all needed access to any users.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM