From: Stephan Szabo <sszabo@kick.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@postgresql.org
Subject: Re: [SQL] Foreign keys breaks tables permissions
Date: Thu, 18 May 2000 19:58:32 -0700
Message-ID: <001b01bfc13e$1df17600$0c64010a@kick.com> (raw)
References: <m12fMDN-0003lFC@orion.SAPserv.Hamburg.dsh.de>
<25918.958691826@sss.pgh.pa.us>
I believe the reason that the trigger does a select for update was because
otherwise there could exist a case that we select and see it and then have
the
row go away afterwards because nothing stops the delete. I could be really
wrong, but I see the scenario as the below:
If the delete happens first, the select for update waits and then knows that
the row isn't there any more and it should fail. If the select for update
happens first, the delete waits and the on delete semantics get operated.
Without the lock, one transaction could delete the row and not have the
on delete happen, because it doesn't see the inserted rows in the other
transaction and the inserting transaction thinks the child is okay because
we can see the parent, but when both commit we have a child without
a parent.
Not that that was probably terribly helpful as to how to go ahead, but...
----- Original Message -----
From: "Tom Lane" <tgl@sss.pgh.pa.us>
To: "Jan Wieck" <wieck@debis.com>
Cc: <pgsql-hackers@postgresql.org>; <pgsql-sql@postgresql.org>
Sent: Thursday, May 18, 2000 4:17 PM
Subject: Re: [SQL] Foreign keys breaks tables permissions
> 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...
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: sszabo@kick.com, tgl@sss.pgh.pa.us, pgsql-hackers@postgresql.org
Subject: Re: [SQL] Foreign keys breaks tables permissions
In-Reply-To: <001b01bfc13e$1df17600$0c64010a@kick.com>
References: <m12fMDN-0003lFC@orion.SAPserv.Hamburg.dsh.de> <25918.958691826@sss.pgh.pa.us> <001b01bfc13e$1df17600$0c64010a@kick.com>
* 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