pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jan Wieck <wieck@debis.com>
Cc: pgsql-hackers@postgresql.org
Cc: pgsql-sql@postgresql.org
Subject: Re: Foreign keys breaks tables permissions
Date: Thu, 18 May 2000 19:17:06 -0400
Message-ID: <25918.958691826@sss.pgh.pa.us> (raw)
In-Reply-To: <m12fMDN-0003lFC@orion.SAPserv.Hamburg.dsh.de>
References: <m12fMDN-0003lFC@orion.SAPserv.Hamburg.dsh.de>

Resurrecting a bug report from mid-April:

wieck@debis.com (Jan Wieck) writes:
>> If one does:
>> 
>> [...]
>> grant select on master to a_user;
>> grant select, insert, update, delete on detail to a_user;
>> 
>> then if login as "a_user" and does:
>> 
>> insert into detail (id, master_id) values (1, 10);
>> 
>> this will result in: "ERROR:   master: Permission denied".
>> 
>> This seems a bug to me ? Isn't it ?

> Outch,

>     yes,  we  missed  something  here.  Peter,  you  said  you'll
>     probably work  on  the  ACL  stuff  after  7.0.  We  need  to
>     coordinate that work with the function manager redesign to go
>     for SETUID triggers and functions.

I looked at this some more because people were complaining that it
was still broken in 7.0.  AFAICT, it's got nothing to do with SETUID
triggers or anything so hairy, it's just a question of what permissions
we think ought to be required for which actions.  The issue is very
simple: the RI insert trigger doesn't do a SELECT on the master table,
it does a SELECT FOR UPDATE --- and execMain.c thinks that that should
require UPDATE access rights to the master.

So, two questions:

1. Why is RI_FKey_check() using SELECT FOR UPDATE and not plain SELECT?

2. What permissions should SELECT FOR UPDATE require?

If the existing code is correct on both these points, then I think the
answer is that there is no bug: updating a table that has a foreign
key reference will require update rights on the master as well.  I would
rather conclude that one of these two points is wrong...

			regards, tom lane



view thread (13+ messages)  latest in thread

Message-ID: <25918.958691826@sss.pgh.pa.us>
Permalink:  ../25918.958691826@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/25918.958691826@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, wieck@debis.com, pgsql-hackers@postgresql.org
  Subject: Re: Foreign keys breaks tables permissions
  In-Reply-To: <25918.958691826@sss.pgh.pa.us>
  References: <m12fMDN-0003lFC@orion.SAPserv.Hamburg.dsh.de> <25918.958691826@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox