Section of structural sheaf in an affine shceme Let $A$ be an integral ring. We consider $X := \text{Spec}(A)$ with its Zariski topology. Let $U$ be an open of $X$ (which is not necessary affine). Let $s$ be a section of
$U$ . Can we say there is $\frac{a}{b} \in \bigcap_{\mathfrak{p} \in U} A_{\mathfrak{p}}$ such that $s_{\mathfrak{p}} = \frac{a}{b}$ for every $\mathfrak{p} \in U$?
The definition I use for the structural sheaf is the Hartshorne one (see, e.g., here : If $(X, \mathcal O_X)$ is a scheme, what is $\mathcal O_X(U)$ where $U$ is any open subset (not necessarily affine open)? ). I'm trying to understand the answer of Alexey Do here : Removing codimension $\ge 2$ subscheme does't change the module of global regular function when he say "The theorem is a consequence of the following theorem".
Thank you in advance.
 A: It depends on the interpretation of your question.
If you're asking whether there exists $f\in \bigcap_{\mathfrak{p}\in U}A_\mathfrak{p}\subseteq \operatorname{Frac} A$ such that a regular function $s:U\to\bigsqcup_{\mathfrak{p}\in U}A_\mathfrak{p}$ is equal to $f$ at all prime ideals $\mathfrak{p}\in U$, then the answer is yes. Indeed, let $\mathfrak{p},\mathfrak{p}'\in U$ be arbitrary. By definition, there exist open sets $V,V'\subseteq U$ with $\mathfrak{p}\in V$, $\mathfrak{p}'\in V'$ and $f\in\bigcap_{\mathfrak{q}\in V}A_\mathfrak{q}$ resp. $f'\in\bigcap_{\mathfrak{q}\in V'}A_\mathfrak{q}$ such that $s(\mathfrak{q})=f$ forall $\mathfrak{q}\in V$ and $s(\mathfrak{q})=f'$ for all $\mathfrak{q}\in V'$. But as $\operatorname{Spec} A$ is irreducible, we habe $V\cap V'\neq \emptyset$, and hence $f=f'$. So $s(\mathfrak{p})=s(\mathfrak{p}')$ in $\operatorname{Frac} A$.
On the other hand, if you are asking whether there always exist $a,b\in A$ such that $b\notin \mathfrak{p}$ and $s(\mathfrak{p})=\frac{a}{b}$ for all $\mathfrak{p}\in U$, then the answer is no. As in this post, take
$$
A=\mathbb{C}[x_1,x_2,x_3,x_4]/(x_1^2x_2-x_3^2,x_2^3-x_4^2,x_2x_3-x_1x_4,x_1x_2^2-x_3x_4)
$$
and $U=(\operatorname{Spec A})\setminus V(x_1,x_2,x_3,x_4)$. Then the section $s\in\mathcal{O}_{\operatorname{Spec} A}(U)$ given by $x_3/x_1$ on $D(x_1)$ and $x_4/x_2$ on $D(x_2)$ (notice that $x_3/x_1=x_4/x_2$ in $\operatorname{Frac} A$ and $U=D(x_1)\cup D(x_2)$) cannot be extended to $\operatorname{Spec} A$. Suppose by contradiction that there exist $a,b\in A$ such that $b\notin \mathfrak{p}$ and $s(\mathfrak{p})=\frac{a}{b}$ for all $\mathfrak{p}\in U$. We then have $U\subseteq D(b)$, i.e. $V(b)\subseteq V(x_1,x_2,x_3,x_4)$, which for dimension reasons can only happen when $V(b)=\emptyset$, i.e. $b$ is a unit. But then $s$ would be defined on all of $\operatorname{Spec} A$, which is not the case.
