Heikki Linnakangas wrote:
> The first time the function is run, all the statements in it are
> planned and the schema used for the insert is resolved. Subsequent
> calls will reuse the same plan.
This post is apparently related:
http://archives.postgresql.org/pgsql-hackers/2007-02/msg00933.php
-- Pedro Gimeno