Sarah Officer wrote:
> 
> - A value must be returned if a return type is specified.  The old &
> new records are available as return values from the plpgsql
> function.

Unfortunately, OLD and NEW are only available in the function that's
directly called by the trigger, not subsequent functions in the call
chain, IIRC.

> - The body of a plpgsql function looks like sql except for reference
> to old and new.  The SQL part of the function must be enclosed with
> 'begin' and 'end;' or there will be a compiler error at run time.

What goes between 'begin' and 'end' are PL/pgSQL statements, of which
SQL is almost a subset.  PL/pgSQL also has a number of plain vanilla
programming language constructs (if-then, loops, etc.).

> - If a trigger function is dropped and recreated, the corresponding
> trigger must also be dropped and recreated.  Otherwise postgres
> 6.5.3 will give a runtime error that the cache lookup failed.

More generally, any function that gets dropped/recreated requires all
the functions/triggers above it in the call chain to be recreated,
IIRC.

Cheers,
Ed Loehr

************

Reply via email to