Re: INSTEAD OF trigger on VIEWs
- From: Russell Smith <mr-russ(at)pws(dot)com(dot)au>
- To: --= Tono =-- <tonodarmodjo(at)yahoo(dot)com>
- Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, pgsql-hackers(at)postgresql(dot)org
- Subject: Re: INSTEAD OF trigger on VIEWs
- Date: Tue, 24 May 2005 19:06:53 +1000
- Message-id: <200505241906.53948.mr-russ@pws.com.au> <text/plain>
On Tue, 24 May 2005 01:26 am, --= Tono =-- wrote:
> I have tried using INSTEAD rules but there are some
> conditional logic that needs to happen inside the rule
> (performing counts, getting and storing the primary
> key of the master record etc.). AFAIK, rules only
> allows conditional logic to be check prior to
> execution of the rule and not inside the rule itself.
> One way to get around this is to allow calling a
> stored procedure inside the rule. This stored
> procedure should have full access of NEW.* (and OLD.*
> in the case of UPDATE and DELETE). This way the
> manual INSERT, UPDATE or DELETE on the actual tables
> can be performed from inside the stored procedure.
>
Would it be possible to add an INSTEAD OF rule that calls
a function. You could then use that function as the trigger
you wanted. I'm not even sure if this is possible.
DO INSTEAD SELECT * FROM function(rowtype);
Regards
Russell Smith.
Home |
Main Index |
Thread Index