Let $X,Y$ be integral Noetherian schemes. Let $f:X\to Y$ be a finite map of schemes. I recently had to show that the set of points $V\subset Y$ over which $f$ is flat is open, as is for instance proven in this stackexchange post.
The exercise asked for a counterexample when we drop the finiteness assumption on $f$. The counterexample I came up with is the following, let $p:Z\to \mathbb{A}^3$ be the blowup of $\mathbb{A}^3$ along $\mathbb{A}^1= V(x,y)$ and let $X= Z\setminus p^{-1}(0)$, then the flat locus of $p:X\to \mathbb{A}^3$ is $D(x,y)\cup V(x,y,z)$ which is not open.
There are two things I dislike about this example
- $X$ is not affine, are there counterexamples where the domain and codomain are affine?
- the map $p:X\to \mathbb{A}^3$ is not surjective.
Are there counterexamples under these additional assumptions?