Re: INSTEAD OF trigger on VIEWs

From: "Jan B(dot)" <jan(at)monso(dot)de>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: --= Tono =-- <tonodarmodjo(at)yahoo(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: INSTEAD OF trigger on VIEWs
Date: 2005-05-23 14:37:18
Message-ID: 4291EA9E.4070005@monso.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I have a similar problem and already considered using RULEs, but I
encountered the problem, that I did not find any way to execute
procedures from RULEs without using SELECT, which creates always a
result set being passed to the application invoking the INSERT, UPDATE
or DELETE, even if the function is declared VOID. This is causing
trouble when using asynchronous command processing.

Christopher Kings-Lynne wrote:

> You can probably just create an INSTEAD rule on the view...
>
> Chris
>
> --= Tono =-- wrote:
>
>> Is there any plans to create an INSTEAD OF trigger on
>> VIEWS? I have view which consists of a master and
>> detail table. When a row is inserted into the view,
>> the view needs to figure out if the master record
>> already exsists. If the record does not exists in the
>> master table, then insert into the master and the
>> detail table. If the record already exists in the
>> master, just insert into detail table. Conversely, if
>> a delete record is performed on the view, the view
>> needs to figure out if it only needs to delete from
>> the detail table, or should it also delete from the
>> master table when all the detail records are already
>> deleted. In Oracle this is easily done using INSTEAD
>> OF triggers. INSTEAD OF triggers can only be created
>> for VIEWs. The purpose of it is to "short-circuit" the
>> event (INSERT, UPDATE or DELETE) and perform whatever
>> is specified in the trigger.
>>
>> CREATE OR REPLACE TRIGGER schema.trigger_name INSTEAD
>> OF INSERT ON object_name BEGIN
>> -- Perform the following instead --
>> END;
>>
>>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2005-05-23 14:46:26 Re: INSTEAD OF trigger on VIEWs
Previous Message Tom Lane 2005-05-23 14:16:06 Re: PATCH to allow concurrent VACUUMs to not lock each