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?