TITLE: composing with a non-flat morphism
QUESTION [6 upvotes]: Let $X,Y,Z$ be integral schemes and $f:X\to Y$, $g:Y\to Z$ be morphisms such that $g$ is flat and $f$ is not flat. Does this imply that the composition $g\circ f:X\to Z$ is necessarily non-flat?
[EDIT: ykm's example works but I'm also interested to know the answer in the case where $X,Y,Z$ have the same dimension].

REPLY [3 votes]: No. Take $Z=Spec k$ where $k$ is a field. Everything is flat over a field.