Re: acessibility for tables

Поиск
Список
Период
Сортировка
От Kraus Philipp
Тема Re: acessibility for tables
Дата
Msg-id 877F2FBA-2210-4D54-8516-D04A9824758C@flashpixx.de
обсуждение исходный текст
Ответ на Re: acessibility for tables  (Willy-Bas Loos <willybas@gmail.com>)
Ответы Re: acessibility for tables  (Willy-Bas Loos <willybas@gmail.com>)
Список pgsql-general
Hi Willey,

you're great :-P


Am 06.06.2012 um 13:12 schrieb Willy-Bas Loos:

I did something like that some years ago.
Albe, are rules out of grace?

create or replace rule _update as on update
to view_firm1 do instead 
update table1 set val = NEW.val where id=old.id;

create or replace rule _update as on update
to view_firm2 do instead 
update table1 set val = NEW.val where id=old.id;

I would like to modify not only one field, but rather the whole record.
I thin NEW is the record of the view with the updated data and OLD the
orginal records (similar to trigger & stored procedure).

I would like to set OLD to NEW if the owner field is correct like:

if record.owner == current_user
    NEW = OLD
else
    do nothing or throw exception
end

Can I do this with the rule on the view?

Thanks

Phil

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

Предыдущее
От: Willy-Bas Loos
Дата:
Сообщение: Re: acessibility for tables
Следующее
От: "Albe Laurenz"
Дата:
Сообщение: Re: acessibility for tables