Re: INSTEAD OF trigger on VIEWs - Mailing list pgsql-hackers

From Russell Smith
Subject Re: INSTEAD OF trigger on VIEWs
Date
Msg-id 200505241906.53948.mr-russ@pws.com.au
Whole thread Raw
In response to Re: INSTEAD OF trigger on VIEWs  (--= Tono =-- <tonodarmodjo@yahoo.com>)
Responses SELECTs inside of VIEWs (WAS: INSTEAD OF trigger on VIEWs)  ("Jan B." <jan@monso.de>)
List pgsql-hackers
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. 


pgsql-hackers by date:

Previous
From: ITAGAKI Takahiro
Date:
Subject: Re: Notification when freespaces empty
Next
From: "Jan B."
Date:
Subject: SELECTs inside of VIEWs (WAS: INSTEAD OF trigger on VIEWs)