Trigger on view

Поиск
Список
Период
Сортировка
От Kyle
Тема Trigger on view
Дата
Msg-id 3F68BA18.2040000@actarg.com
обсуждение исходный текст
Список pgsql-sql
I'm trying to set up a trigger that restricts when and how updates are 
done to the records in a relation.  However, when the administrator 
accesses the relation, I want the restriction to be relaxed.

My approach was to have a view that is accessed by the normal users and 
have the admin access the table directly.  However, it doesn't appear 
that I can actually apply a trigger to a view.

Some of this I can do with rules on the view, but certain restrictions 
are applicable only on a row-by-row basis, so I think I need to do it in 
a BEFORE trigger.

Is there a way I can either:

1. Apply a trigger to a view.  The trigger would actually get registered 
with the underlying table, but would only be invoked if the user had 
entered via the view.

2. Detect inside the trigger function whether the user had accessed the 
table directly or through the view so I could invoke conditional code 
accordingly.

I want to avoid hardcoding user ID's in the trigger, so I'm trying to 
take this approach so it can all be handled simply by granting 
privileges on different views to enable/disable the varying levels of 
restriction.

Any ideas?

Kyle Bateman




В списке pgsql-sql по дате отправления:

Предыдущее
От: miko@idocs.com (Miko O'Sullivan)
Дата:
Сообщение: Re: [BUGS] session variable
Следующее
От: wireless200@yahoo.com (wireless)
Дата:
Сообщение: how to get decimal to date form