New in 8.1 it seems functions marked STABLE are
not allowed to have any INSERT statement in them.
However in this particular case, the insert does not
violate the rule:
"STABLE indicates that within a single table scan the function will
consistently return the same result for the same argument values, but
that its result could change across SQL statements."
it does basically lookup a value by a foreign key
and builds a surrogate key on demand.
I know I could make it volatile but otoh I really want
the optimizer to optimize calls away as possible.
Now, what to do beside a private revert to the
patch?
Regards
Tino