Re: ADD FOREIGN KEY (was Re: [GENERAL] 7.4Beta)

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Jan Wieck <JanWieck(at)Yahoo(dot)com>, Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Peter Childs <Blue(dot)Dragon(at)blueyonder(dot)co(dot)uk>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ADD FOREIGN KEY (was Re: [GENERAL] 7.4Beta)
Date: 2003-09-30 15:29:54
Message-ID: 20030930082522.L15622@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers


On Tue, 30 Sep 2003, Tom Lane wrote:

> Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> writes:
> > As a side note, in the partial implementation I'd already done, I noticed
> > a potential problem if the person doing the alter table didn't have read
> > permissions on the pktable. I'd written it to bail and do the slow check
> > in that case (well actually in most error cases that didn't themselves
> > cause an elog), does anyone have a better idea?
>
> Wouldn't all the subsequent triggers fail also in such a case? (For
> that matter, wouldn't the existing implementation of the initial check
> fail?) I can't see a reason to expend code to avoid failing here. It's

No, because the triggers change permissions to the owner of the
appropriate (either fk or pk) table before running the query, so the old
method works as well as the final constraint would. However, if the two
owners are not the same, you can't set to both during the single query.

> not very sensible to be able to create an FK on a table you don't have
> read permission for.

IIRC, you only need references permissions to make an fk constraint, not
select.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Greg Stark 2003-09-30 15:44:46 Re: Functional index performance question
Previous Message Tom Lane 2003-09-30 15:15:58 Re: ADD FOREIGN KEY (was Re: [GENERAL] 7.4Beta)

Browse pgsql-hackers by date

  From Date Subject
Next Message Andreas Pflug 2003-09-30 16:01:28 Re: GPL code issue?
Previous Message Tom Lane 2003-09-30 15:15:58 Re: ADD FOREIGN KEY (was Re: [GENERAL] 7.4Beta)