I would like to know in what generality do we have pushouts for schemes/stacks/derived stacks. More precisely, let $f : X \rightarrow Y$ be a proper flat surjective morphism of schemes of finite type over $k$ and $g: X \rightarrow Z$ be an etale map. Is there a pushout $T$ (scheme? stacks? derived scheme?) that makes the diagram commutative:
$$ \begin{matrix} X & \rightarrow & Z \\ \downarrow & & \downarrow \\ Y & \rightarrow & T \end{matrix} $$
I think that if $ f : X \rightarrow Y$ is assumed to be a closed immersion, then Ferrand proved that such a pushout exists in the category of schemes. But I am really interested when $f : X \rightarrow Y $ is a proper flat surjective morphism.
Thanks in advance.
EDIT : People gave me all sorts of nice references, but whatever the level of abstraction (schemes, stacks, derived stacks) the theorems they refer to always concern closed immersions. However, there are some "trivial" cases where the pushout exists without closed immersions coming into the picture. For instance, assume that $g : X \rightarrow Z$ is the quotient of $X$ by a finite group $G$ acting transitively without fixed points and assume that $f$ is $G$-equivariant. Then, it seems clear that the pushout exists.
If you remove the $G$-equivariant assumption on $f$, but you impose some regularity (like flatness or smoothness), I was wondering if the pushout still exists, perhaps as a very abstract object (derived stack?)?