Fixed #22875: Optimizer did not take through= into account.