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