Buster Posey will undergo season-ending hip surgery and could be out six to eight months.

"It's something that needs to be taken care of," Bruce Bochy said Saturday. "It's the wear and tear of playing the game that's caught up with him a little bit. When we get this thing rehabbed, I know Buster's going to be happy to have this behind him."

Posey has dealt with the injury all season.

Posey will visit Dr. Marc J. Philippon, in Vail, Colorado, for the procedure to repair his labrum and to remove a bone spur in his right hip. The recovery timeline could cause him to miss part, if not all, of spring training, but Posey was optimistic.

"If things go smoothly with no hiccups, I'll be ready to go next Opening Day," Posey told reporters Friday.