Jeff Davis <list-pgsql-general(at)empires(dot)org> writes:
> Is there a way I can make it only do a function call once, and use the value
> after that for all NEW.id's?
No. A rule is a macro, and so it has all the standard issues about
multiple evaluations of arguments.
> Is a trigger a better option here perhaps?
Yes. If you want access to the specific values inserted, a trigger is
almost always a better bet.
regards, tom lane