pgsql-bugs@postgresql.org writes:
> The function crashes, when the corresponding user is not found.
If this is 7.1.1, then that's an already-known problem (I broke
plpgsql's SELECT for the case of no rows found :-(). It'll be
fixed in 7.1.2, or you can get the source-code patch from
techdocs.postgresql.org.
regards, tom lane