From: | Kraus Philipp <philipp(dot)kraus(at)flashpixx(dot)de> |
---|---|
To: | Willy-Bas Loos <willybas(at)gmail(dot)com> |
Cc: | Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: acessibility for tables |
Date: | 2012-06-06 11:26:50 |
Message-ID: | 877F2FBA-2210-4D54-8516-D04A9824758C@flashpixx.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Manoj Agarwal | 2012-06-06 11:30:20 | Problem while restoring a database from SQL_ASCII to UTF-8 |
Previous Message | Willy-Bas Loos | 2012-06-06 11:12:17 | Re: acessibility for tables |