Updated postgres functions
Added rev to postgres tables