Let $f:X\rightarrow Y$ be a dominant morphism of projective (and smooth if you like) varieties over an algebraically closed field $k$ such that $n=\dim(X)=\dim(Y)$. Then $f$ is proper, so by Chevalley's upper semi-continuity theorem, $\dim(X_y)$ is upper semi-continuous on $Y$. Since $f$ is dominant, on an open subset $U\subseteq Y$, $X_y$ is 0 dimensional for all $y\in U$. My question is, can we say $Y\setminus U$ must have codimension at least 2?
We can construct an example where the codimension is exactly two by taking the blowup $B$ of $\mathbb{P}^2$ at a point and looking at the natural map $B\rightarrow\mathbb{P}^2$. If we did not impose that $X$ is irreduicible this need not be true, for example $(xy)\subseteq \mathbb{P}^2$ mapping to $\mathbb{P}^1$ via projection has a one dimensional fiber above the origin. I cannot seem to find an irreducible example and am hoping the answer to the above is positive.
Thanks