affine open subset of affine scheme Let $X=Spec(A)$ be an affine scheme and $U=Spec(R)$ be an affine open subset of $X$. Is it true that $R$ is an localization of $A$, i.e. $R=S^{-1}A$ for some closed multiplication subset $S\subset A$ ? 
 A: No. This question is pretty closely related to  this other question, but let me give an answer nonetheless:
Consider an elliptic curve $E$ in $\mathbb{P}^2(\mathbb{C})$, choose coordinates $[x:y:z]$ of $\mathbb{P}^2(\mathbb{C})$ in a way that the line $z = 0$ intersects $E$ at an inflection point $O$. Let $X := E \setminus \lbrace z = 0 \rbrace$. Choose a point $P \in E$ such that $P$ is not a torsion point with respect to the group structure on $E$ for which $O$ is the origin. Let $U := X \setminus \lbrace P \rbrace$. Then $U$ is an open affine subset of $X$, but there is no $f \in A:=\mathbb{C}[X]$ that vanishes only at $P$. So $\mathbb{C}[U]$ cannot contain $A_f$ for any non-constant $f \in A$.  
A: Concerning characterization of an affine open subset U in an affine scheme Spec(A) , with complementary Y, I got the following answer. One uses Serre's affinity criterion. This gives conditions on cohomology whith supports in Y (cohomological dimension). If the ring A is regular, then the characterization is : codim(Y) = 1 purely (Cartier divisor) !.
