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. 

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

Reply via email to