Include the timestamp in the group_by to make pg happy - thanks faitout