Re: Cascade delete triggers change user credentials

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Antonios Christofides <anthony(at)itia(dot)ntua(dot)gr>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Cascade delete triggers change user credentials
Date: 2004-02-16 21:56:58
Message-ID: 20040216134422.D19658@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message andrew 2004-02-16 22:28:49 pg_dump and circular dependency
Previous Message Richard Huxton 2004-02-16 20:24:18 Re: to_char problem