TITLE: Pushouts in the Category of Schemes
QUESTION [29 upvotes]: When does it make sense to glue schemes together along subschemes?
In particular: is there a way to glue two schemes together along a closed point (say we're working over a field)? Can you glue two closed points of the same scheme together? 
Is it easier to glue in the category of algebraic spaces?

REPLY [4 votes]: Since it doesn't seem to have been mentioned yet, Ferrand proves in Theorem 7.1 of "Conducteur, descent, et pincement" that you can pushout closed immersions $Y' \to X'$ along various nice affine morphisms $g: Y' \to Y$. 
For example, if $g$ is finite, and every finite set of points of $X'$ and $Y$ are contained in an open affine (e.g., they are projective varieties) then the pushout exists (Theorem 5.4 of loc.cit.).