Hannu Krosing <hannu@tm.ee> writes:
> Is it normal that a query that takes <1 sec when executed from psql
> prompt takes > 15 sek when executed from a function
No. I can't reproduce the quoted misbehavior under either 7.0.2 or
current sources; your example takes ~1 sec either way for me.
regards, tom lane