Re: permission denied for schema even as superuser.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Chris Young <chris(at)chris(dot)net(dot)au>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: permission denied for schema even as superuser.
Date: 2011-05-05 15:27:37
Message-ID: 4275.1304609257@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Chris Young <chris(at)chris(dot)net(dot)au> writes:
> Greetings,
> I'm trying to perform the following query, but receive a perplexing error,
> even as superuser (postgres):

> umdb_db=# insert into mainview_teststatusevent
> (timestamp,host_id,test_id,old_status_id,new_status_id) values(now(),
> 726,4,6,1);
> ERROR: permission denied for schema nms
> LINE 1: SELECT 1 FROM ONLY "nms"."mainview_status" x WHERE "id" OPER...
> ^
> QUERY: SELECT 1 FROM ONLY "nms"."mainview_status" x WHERE "id"
> OPERATOR(pg_catalog.=) $1 FOR SHARE OF x

> Could you please let me know how I might troubleshoot and/or fix this
> 'permission denied' error? I'm running 9.0.4.

That's a foreign key checking query. FK checks are done as the owner of
the target table, not as the user who did the original query. So your
problem is that the owner of mainview_teststatusevent lacks permissions
to access the other table (or more specifically, the schema it's in).

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John Cheng 2011-05-05 16:27:47 Re: Cannot reproduce why a query is slow
Previous Message Tom Lane 2011-05-05 15:22:07 Re: postgres segfaulting on pg_restore