added postgress function for reporting