Let $X,Y$ be schemes, not necessary separated. Let $f:X\to Y$ be a morphism of schemes and $f(x)=y~,x\in X,~y\in Y$. Then we have the scheme theoretic fiber over $y$, i.e. $f^{-1}(y)=X\times_{Y} \text{Spec } \mathbb k(y)$ where $\mathbb k(y)$ is the residue field at $y$. I was told that $\mathcal O_{x,f^{-1}(y)}=\mathcal O_{x,X}\otimes_{\mathcal O_{y,Y}}\mathbb k(y)$. I can show this fact by writing down the rings involved explicitly and the proof only works for this special fiber product. I am now asking if there is a generalization, as follows.
Let $X,Y,Z$ be schemes, $f:X\to Z,~g:Y\to Z$ be morphisms of schemes, suppose that $w\in W=X\times_Z Y$ such that $w$ is sent to $x$, $y$ and $z$ in $X$, $Y$ and $Z$ respetively. Are $\mathcal O_{x,X}\otimes_{\mathcal O_{z,Z}} \mathcal O_{y,Y}$ and $\mathcal O_{w,W}$ naturally isomorphic? Note that there might be more than one $w$ over the pair of points $(x,y)$, they much have the same local rings if my guess is true.
I tried to prove this via commutative algebra. The question is local. Let $X,Y,Z$ be $\text{Spec } A,\text{Spec } B,\text{Spec } C$, respectively. Let $x,y,z,w$ correspond to prime ideals $P_1,P_2,Q,I$, respectively. Then I have to prove that $(A\otimes_C B)_I=A_{P_1}\otimes _{C_Q} B_{P_2}$. I want to check the universal property of tensor products. Given $\alpha:A_{P_1}\to E,\beta:B_{P_2}\to E$ such than they coincide when restricted to $C_{Q}$, we have a unique homomorphism $\gamma: A\otimes_C B\to E$. The only thing remaining to be checked is that $\gamma$ maps the complement of $I$ to units. And I am stuck here.
If my guess is true, would you help me finish my proof? Of course I will appreciate more if you give a better proof. If my guess is false, then what is the right conditions making it ture?