Re: AW: AW: [HACKERS] Rule system - Mailing list pgsql-hackers

From Vadim Mikheev
Subject Re: AW: AW: [HACKERS] Rule system
Date
Msg-id 35D39A61.AFD397EA@krs.ru
Whole thread Raw
In response to Re: AW: AW: [HACKERS] Rule system  (jwieck@debis.com (Jan Wieck))
Responses Re: AW: AW: [HACKERS] Rule system  (jwieck@debis.com (Jan Wieck))
List pgsql-hackers
Jan Wieck wrote:
>
>     It might look like:
>
>         create trigger mytrig before insert or update on mytab
>             for each row do (
                           ^^
Why not EXECUTE ?

>                 begin
>                     new.lastupdate := 'now';
>                     return new;
>                 end;
>             ) language 'plpgsql';
>
>     This  would be easy. Just an enhancement to the parser and to
>     the create trigger  utility  processing  so  it  creates  the
>     required  function  on  the fly. Modification of new, raising
>     errors via elog() and suppressing  the  operation  itself  by
>     returning  NULL  is  already there in PL/pgSQL. We would need
>     something smart for the functions  name,  because  using  the
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>     trigger  name  only  would  break  the current possibility to
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>     define  the  same  trigger  name  on  different  tables  with
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>     different actions. Something like __trig_<oid> would be good.
      ^^^^^^^^^^^^^^^^^
I missed here. What did you mean?

Vadim
P.S. Sorry, I'm very busy currently :((

pgsql-hackers by date:

Previous
From: jwieck@debis.com (Jan Wieck)
Date:
Subject: Re: [HACKERS] tuple return from function
Next
From: "Thomas G. Lockhart"
Date:
Subject: Re: [HACKERS] Re: type coersion (was OR clause status)