In this MO question it was raised the topic of "gluing constructions" in the category of schemes. I understand the phrase "gluing two schemes along maps to them" as "there exists a coproduct of the two schemes (with respect to the two given morphisms) in the category of schemes".
Let's consider the affines first. If $R'$, $R''$ and $R$ are rings, and $\phi': R' \to R$ and $\phi'':R''\to R$ are homomorphisms, then one can define the ring
$A=R'\times_{\phi',R,\phi''} R'':=\;${$(a,b)\in R'\times R''$ | $\phi'(a)=\phi''(b)$}.
The first question is:
Is the ring $A$ so constructed always the fibered product in the category of rings of $R'$ and $R''$ along the prescribed maps $\phi'$ and $\phi''$ ? (I guess this may be answered by abstract nonsense alone)
In case the answer to the above question is "yes", then one automatically gets the existence of fibered co-products (i.e. verifying the dual universal property than fibered products) in the category of affine schemes.
So one may ask:
Under which assumptions does it carry over to the non-affine case?
Best Answer
There is a pretty good account of how this works in Karl Schwede's paper:
MR2182775 (2006j:14003)
Karl Schwede, Gluing schemes and a scheme without closed points.
Recent progress in arithmetic and algebraic geometry, 157–172, Contemp. Math., 386, Amer. Math. Soc., Providence, RI, 2005
See also this paper:
MR2044495 (2005a:13016)
Ferrand, Daniel Conducteur, descente et pincement.
Bull. Soc. Math. France 131 (2003), no. 4, 553–585.