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 :((