TITLE: Description of $R \otimes R$ for $R$ a ring of integers
QUESTION [7 upvotes]: If $K/k$ is a finite Galois extension of fields, with Galois group $G$, there's an isomorphism
$$ K \ \otimes_k \ K \simeq \oplus_{\sigma_i \in G} \ K$$
given by sending $a \otimes b$ to $ (...,  \sigma_i(a) b, ...)$ and extending linearly. This is even an isomorphism of $K$-vector spaces, where $a \in K$ is acting by multiplication on the first factor in $K \otimes K$, and by multiplication by $(\sigma_i(a))$ on $\oplus_{\sigma_i} K$. There's also an obvious $k[G]$-module structure that's preserved.
My question is what happens if instead of $K$, we consider $R \otimes_S R$, where $R$ and $S$ are the rings of integers of number fields $K$ and $k$ respectively. I tried playing around with quadratic extensions, and I'm pretty sure that the same map above from $R \otimes R$ to $\oplus R$ is not surjective, so the same argument doesn't work? Is there a nice description of $R \otimes R$ as either an $R$ module, or an $S[G]$ module?
Thanks.

REPLY [4 votes]: Let $\Delta$ denote the discriminant of $R$ over $S$.  One then has that
$R[1/\Delta]\otimes_S R[1/\Delta] = \prod_{\sigma \in G} R[1/\Delta].$
On the other hand, this is false without inverting $\Delta$.
Consider e.g. the simplest case:
$$\mathbb Z[i] \otimes_{\mathbb Z} \mathbb Z[i] = \mathbb Z[i][x]/(x^2+1)
= \mathbb Z[i][y]/y(y-2)$$
(where for the final equality, we set $y = -ix+1$).
If we invert $2$, then we can rewrite this as $\mathbb Z[i,1/2][z]/z(z-1)$
(setting $z = y/2$), which is a product of two copies of $\mathbb Z[i,1/2]$.
But Spec $\mathbb Z[i]/y(y-2)$ is connected (it contains only one point lying 
over the prime $2$ of $\mathbb Z$), and hence it does not factor as a non-trivial product.