HelloI suggest use plpgsql_check extension: https://github.com/okbob/plpgsql_check/ It can found some possible errors in plpgsql code.Postgresql itself does not check function body correctnes on create.
regards, Sergei