TalGloz <glozmantal@gmail.com> writes:
> This is very strange, even if I comment all the loops in the function and
> leave only the INSERT INTO command the insert still doesn't happen.
Maybe you're rolling back the transaction after leaving the function?
regards, tom lane