Re: Cascade delete triggers change user credentials - Mailing list pgsql-general

From Stephan Szabo
Subject Re: Cascade delete triggers change user credentials
Date
Msg-id 20040216134422.D19658@megazone.bigpanda.com
Whole thread Raw
In response to Cascade delete triggers change user credentials  (Antonios Christofides <anthony@itia.ntua.gr>)
Responses Re: Cascade delete triggers change user credentials  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Cascade delete triggers change user credentials  (Antonios Christofides <anthony@itia.ntua.gr>)
List pgsql-general
On Mon, 16 Feb 2004, Antonios Christofides wrote:

> Hi, I've prepared a test case about this, which I include below. I
> have tables "a" and "b"; "b" has a foreign key to "a", on delete
> cascade. In addition, there is a "before delete on b" trigger, which
> all that does is show the current_user. If a row is deleted from "a",
> and this triggers a delete from "b", which in turn activates the
> show_current_user trigger, the triggered function selects
> "current_user", and the result is the user who created "b", not the
> currently connected user.
>
> Is this a bug? Is there any workaround? I'm running Debian 3.0 with
> its prepackaged PostgreSQL 7.2.1. I greatly appreciate your help.

The triggered actions occur as if done by the owner of the fktable so that
they will not fail if the current user does not actually have delete
access on that table. I'm not sure which result for current_user makes
more sense in that context for further triggered actions.

pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: to_char problem
Next
From: Troy Campano
Date:
Subject: Re: [ADMIN] create ONE database beyond between 2 server