changing max from timestamp (not pg compatible?) to id