Search Postgresql Archives

Re: acessibility for tables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux