Postgres User Defined Exception Program