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: 2005-05-24 09:06:53
Message-ID: 200505241906.53948.mr-russ@pws.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan B. 2005-05-24 10:43:40 SELECTs inside of VIEWs (WAS: INSTEAD OF trigger on VIEWs)
Previous Message ITAGAKI Takahiro 2005-05-24 08:23:26 Re: Notification when freespaces empty