A naive algebraic geometry question Suppose $X$ is a scheme over a ring $A$, $B$ is an $A$-algebra, and $X\times_AB$ is affine. I am looking for conditions on $A$ and $B$ (and perhaps the structure morphism of $X$ over $A$) that will force $X$ to be affine as well.
A trivial observation is that if $B$ is zero, $X\times_AB$ is affine ($Spec 0$), and that says nothing about $X$. One situation that I'm guessing the desired conclusion might hold is if $A$ and $B$ are fields, but I don't have a proof. Maybe it is enough to have $Spec B\rightarrow Spec A$ faithfully flat, but again I am not sure. Any input is appreciated.
 A: Suppose the structure morphism $g: X\to \operatorname{Spec}(A)$ is separated and of finite type, and $f: \operatorname{Spec}(B)\to \operatorname{Spec}(A)$ is faithfully flat; furthermore, assume $A, B, X$ are all Noetherian.  Denote $X\times_A B$ as $X_B$ and let $f': X_B\to X$ be the base change of $f$ along $g$, and $g': X_B\to \operatorname{Spec}(B)$ the base change of $g$ along $f$.
By Serre's affineness criterion, it suffices to show that $R^ig_*\mathcal{F}=0$ for $i>0$ and $\mathcal{F}$ an arbitrary quasi-coherent sheaf on $X$.
By flat base change, the morphism $f^*R^ig_*\mathcal{F}\to R^i{g'}_*{f'}^*\mathcal{F}$ is an isomorphism for any quasi-coherent sheaf $\mathcal{F}$ on $X$.   As $X_B$ is affine, the right hand side vanishes for $i>0$.  Thus $f^*R^ig_*\mathcal{F}=0$; as $f$ is faithfully flat, this implies $R^ig_*\mathcal{F}=0$ as well, as desired.
In fact, we needn't assume $X\to \operatorname{Spec}(A)$ is separated and finite type, as these properties descend through fpqc morphisms.  I haven't thought about dropping the Noetherian hypotheses.
Thus we've shown that if $A\to B$ is faithfully flat and everything is Noetherian, affineness descends.

Here's an example to see that some hypothesis on $f$ is necessary.  Let $A$ be a local ring and $B$ its residue field.  Let $X=\mathbb{P}^1_A\setminus\{x\}$ where $x$ is any closed point of $X$.  Then $X_B$ is $\mathbb{A}^1_B$, whereas $X$ is obviously not affine (as its generic fiber is $\mathbb{P}^1$).  I don't see an easy example where $f$ is flat but not faithfully flat at the moment (aside from stupid things, e.g. with $\operatorname{Spec}(A)$ disconnected).

I've just noticed that the Stacks Project gives a proof of this claim, avoiding the Noetherian hypotheses and Serre's criterion.
