Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 91C7F1337B69 for ; Sun, 12 Dec 2010 12:11:28 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 54567-01 for ; Sun, 12 Dec 2010 16:11:21 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 2F6691337B64 for ; Sun, 12 Dec 2010 12:11:21 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id oBCGBJmk004448; Sun, 12 Dec 2010 11:11:19 -0500 (EST) To: David Underhill cc: pgsql-admin@postgresql.org Subject: Re: FOR SHARE permissions In-reply-to: References: Comments: In-reply-to David Underhill message dated "Sat, 11 Dec 2010 19:47:50 -0800" Date: Sun, 12 Dec 2010 11:11:19 -0500 Message-ID: <4447.1292170279@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201012/83 X-Sequence-Number: 36312 David Underhill writes: > I have two tables. One has a foreign key referencing a serial field in the > other table. I've given INSERT privilege to a role other than the owner, > but I still can't insert into the table containing the foreign key unless I > grant the *owner* of the table UPDATE privilege on the table containing the > referenced field. > I don't quite understand why the *owner* needs to have UPDATE permission in > order for another distinct role (with INSERT privilege) to be able to insert > a row in this case. The owner is the one who established the foreign key reference. That reference is no concern of the third-party user who's been given insert permission on the referencing table. The design you seem to have in mind would make management of permissions a lot more complicated, since instead of just granting insert permission to the third party, you'd have to think about all the subsidiary permissions that might be needed to deal with the table's FK linkages. regards, tom lane