Foreign keys and permissions oddity

From: Joshua Tolley <eggyknap(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Foreign keys and permissions oddity
Date: 2010-08-07 00:13:18
Message-ID: 4c5ca528.12968e0a.1d7c.7f80@mx.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sandeep Srinivasa 2010-08-07 03:19:40 Re: MySQL versus Postgres
Previous Message Raymond O'Donnell 2010-08-06 21:17:10 Re: MySQL versus Postgres