[1.7.x] Fixed #22875: Optimizer did not take through= into account.