Skip site navigation (1) Skip section navigation (2)

Re: Triggers after a rule

From: Wijnand Wiersma <wwiersma(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Triggers after a rule
Date: 2005-09-28 10:40:17
Message-ID: fb4cc2420509280340c76db0d@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-general
2005/9/28, Richard Huxton <dev(at)archonet(dot)com>:
> Wijnand Wiersma wrote:
> > I thought that when a rule is applied the triggers which are triggerd
> > would also have the same userid as the rule query, but I was wrong.
>
> Can you show the (cut down) contents of your trigger? It's difficult to
> see what you mean. I can't think of any way a trigger can provide
> results to the user, so any selects within it should be safe enough.

The trigger function is very very long and touches tables the normal
user should not touch. I can't grant select, update and insert to the
users, there is only one user who has the rights to do that. Normal
users should work with the given views and those views are made so
that users only see information that is relevant for them.

database=> update v_my_account set pause='yes';
ERROR:  permission denied for relation contact
CONTEXT:  PL/pgSQL function "activate_contact" line 5 at select into variables

The rule update_v_my_account works and runs as the special user since
that user is owner of v_my_account. It is just strange that the
triggers run as my normal user.

Wijnand

In response to

Responses

pgsql-general by date

Next:From: Martijn van OosterhoutDate: 2005-09-28 11:05:44
Subject: Re: trigger self recursion
Previous:From: rubenDate: 2005-09-28 10:33:02
Subject: Re: SQL command to dump the contents of table failed: PQendcopy()

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group