On 08/23/2012 10:19 PM, Gauthier, Dave wrote:
> Updateable views. This is great. I didn't know about these. Absolutely delicious !
> I found a great example here... http://vibhorkumar.wordpress.com/2011/10/28/instead-of-trigger/
>
> The problem of user updating >1 alias remains, but I have no problem bouncing them if they attempt that. Maybe
returna "-E- You cannot update multiple aliases of the same base value" (something like that). I'd just have to detect
thiscircumstance, raise the message and bounce (return OLD).
>
> Does this sound doable?
With a RULE, probably not.
With a `DO INSTEAD` view trigger - available in Pg 9.1 and above - yes.
I'd recommend using a view trigger instead of a rule if at all possible.
Rules are tricksy things and sooner or later they'll bite you.
--
Craig Ringer