Jeff Ross <jross@wykids.org> writes:
> Now I'm *really* confused. I thought the table structure I created at
> the beginning of the function was where the results would be returned
> to.
Uh, you're using that as the destination for the FOR loop's SELECT.
What exactly is the purpose of having a second SELECT within the loop?
regards, tom lane