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.