Giants catcher Posey to have season-ending hip surgery