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, 2018 at 1:05

1 Answer 1


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, 2018 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, 2018 at 20:37

Your Answer

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

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