Brian Blaha <bblaha@umr.edu> writes:
> I would like to write a function as a set of SQL statements, and then
> use that function
> in a trigger. However, since triggers require a return type of opaque,
> and SQL functions
> cannot return type opaque, this doesn't look possible.
You could call a SQL function from a trigger, but it can't be a trigger
itself; at present triggers have to be in C, plpgsql, or pltcl (maybe
plpython? Not sure about that one).
For what you are doing (transferring info from one table to another)
I suspect a rule might work better than a trigger anyway.
regards, tom lane