Coproducts of schemes ("gluing construction") ? 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?

 A: 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. 
A: Gluing produces a coproduct only when you glue along the empty subscheme. In general, if we glue $X$ and $Y$ along maps $U \to X , U \to Y$ together, we want to get the pushout (also called amalgamated sum) of the diagramm $X \leftarrow U \to Y$.
The answer to the first question is, of course, yes. You can verify the universal property directly. More generally, every limit can be constructed via products and equalizers, which is a fact from basic category theory. In particular, a fiber product of the diagram $A \to C \leftarrow B$ is equal to the equalizer of $A \times B \to A \to C$ and $A \times B \to B \to C$.
Also Sándor Kovács has already pointed you to Karl Schwede's paper in which the second question is answered, let me just say that this article shows that pushouts along closed immersions exist and are given locally by the fiber product of rings. But in general, pushouts of schemes do not exist at all. See this question.
