Jocelyn Turcotte <turcotte.j@gmail.com> writes:
> i'm wondering if there is a way to prepare and execute a plan in a
> plpgsql function.
You do not need that because plpgsql automatically caches plans for
SQL statements appearing in a plpgsql function.
regards, tom lane