Foreign keys and permissions oddity - Mailing list pgsql-general

From Joshua Tolley
Subject Foreign keys and permissions oddity
Date
Msg-id 4c5ca528.12968e0a.1d7c.7f80@mx.google.com
Whole thread Raw
Responses Re: Foreign keys and permissions oddity
List pgsql-general
Is there some justification for this behavior that I should know already? It
seemed awfully strange when some folkds here stumbled on it:

$ create user a;
$ create user b;
$ commit;
$ \c - a
$ create table foo (id integer primary key);
$ revoke all on foo from a;
$ grant all on foo to b;
$ commit;
$ \c - b
$ create table bar (foo_id integer references foo (id));
$ commit;
$ insert into bar values (1);
ERROR:  permission denied for relation foo
CONTEXT:  SQL statement "SELECT 1 FROM ONLY "public"."foo" x WHERE "id" OPERATOR(pg_catalog.=) $1 FOR SHARE OF x"

The key point seems to be that the owner of the referenced table has no
permissions on the table, although the referencing user does.

--
Joshua Tolley / eggyknap
End Point Corporation
http://www.endpoint.com

Attachment

pgsql-general by date:

Previous
From: "Joshua J. Kugler"
Date:
Subject: Re: MySQL versus Postgres
Next
From: Sandeep Srinivasa
Date:
Subject: Re: MySQL versus Postgres