1

I have logged in as superuser and created a readonly user.

When I run grant command, it says that schema does not exists

I am logging in as root:

sql -h myhost_name -U root -d postgres -W

grant usage on schema autorsid to readonly ;
ERROR:  schema "autorsid" does not exist

while schema does exists but schema owner is not root.

Isn't when you are superuser, we should be able to grant permissions for all database/schema/tables etc.

  • Does the schema exist in the "postgres" database, or does it exist in some other database in the same cluster? Not even superusers can cross database boundaries. – jjanes May 30 '18 at 1:05
0

Try grant with double quotes around schema name:

grant usage on schema "autorsid" to readonly ;

  • still same thing. As a root ( which is superuser on AWS postgres), db_autorsid=> grant usage on schema "autorsid" to readonly ; ERROR: permission denied for schema autorsid db_autorsid=> – Sanjay May 30 '18 at 20:33
  • I can grant permission when I connect to user who owns schema ( schema owner) but not when I am connected to superuser. So what exactly is superuser in Postgres, I need something to sqlplus / as sysdba or sys user in oracle which can grant all kind of priviliges. – Sanjay May 30 '18 at 20:37

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.