Re: Foreign keys and permissions oddity

From: Richard Huxton <dev(at)archonet(dot)com>
To: Joshua Tolley <eggyknap(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Foreign keys and permissions oddity
Date: 2010-08-07 07:34:12
Message-ID: 4C5D0C74.7000006@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 07/08/10 01:13, Joshua Tolley wrote:
> Is there some justification for this behavior that I should know already? It
> seemed awfully strange when some folkds here stumbled on it:
[snip]
> The key point seems to be that the owner of the referenced table has no
> permissions on the table, although the referencing user does.

Presumably the underlying trigger functions are executing as the owner
of the table. This would make sense in the (more common) case that you
want to reference a table you don't necessarily have full read access
for (e.g. member-id vs the whole row including address/phone).

You should be able to track the table's OID from pg_class through to
tgrelid on pg_trigger and then tdfoid to the relevant OIDs in pg_proc.
The functions are all named as RI_FKey_xxx.

Hmm - not sure if they execute as the table owner or the creator of the
constraint. You could justify either, but of course they're frequently
the same (as in your case).

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2010-08-07 10:08:01 Re: MySQL versus Postgres
Previous Message PIC2010 2010-08-07 05:09:42 2010 International Conference on Progress in Informatics and Computing(PIC-2010 )