add pgplsql function and its testing