Does taking sections commute with base change? Let $X$ be a scheme over a field $k$, and let $K$ be a field extension of $k$.
Let $X_K$ denote the base change. I want to know whether for any open $U\in X,\mathscr O(U_K)=\mathscr O(U)\otimes_k K.$ 
I believe this should be true, since for any affine open $V=specA$ inside $U$, we have $\mathscr O (V_K)=A\otimes_k K=\mathscr O(V)\otimes_k K,$ so maybe, since the sections agree locally, they should be the same. But I'm not sure how to put this rigorously. Any help would be appreciated.
 A: This is true if $U$ is quasi-compact and quasi-separated. (A more general statement is e.g. here.)
Since $U$ is quasi-compact, there is a finite cover $U = \bigcup_{i=1}^{n} U_{i}$ where each $U_{i}$ is affine open. Thus we obtain a diagram 
$$
\newcommand{\ra}[1]{\kern-1.5ex\xrightarrow{\ \ #1\ \ }\phantom{}\kern-1.5ex}
\newcommand{\ras}[1]{\kern-1.5ex\xrightarrow{\ \ \smash{#1}\ \ }\phantom{}\kern-1.5ex}
\newcommand{\da}[1]{\bigg\downarrow\raise.5ex\rlap{\scriptstyle#1}}
\begin{array}{c}
0 & \ras{} & \mathscr{O}(U) \otimes_{k} K & \ras{} & \prod_{i=1}^{n} (\mathscr{O}(U_{i}) \otimes_{k} K) & \ras{} & \prod_{i,j=1}^{n} (\mathscr{O}(U_{i} \cap U_{j}) \otimes_{k} K) \\
 & & \da{g_1} & & \da{g_2} & & \da{g_3} & \\
0 & \ras{} & \mathscr{O}(U \times_{k} K) & \ras{} & \prod_{i=1}^{n} \mathscr{O}(U_{i} \times_{k} K) & \ras{} & \prod_{i,j=1}^{n} (\mathscr{O}((U_{i} \cap U_{j}) \times_{k} K)) \\
\end{array} $$
where both rows are exact (the first row is exact since $k \to K$ is flat). Here $g_{2}$ is an isomorphism since each $U_{i}$ is affine; thus $g_{1}$ is injective. Applying the above argument with $U$ replaced by $U_{i} \cap U_{j}$ (which is quasi-compact since $U$ is quasi-separated), we obtain that $g_{3}$ is injective. Thus $g_{1}$ is an isomorphism by a diagram chase.

Here is an example showing that the map $$ \mathcal{O}(U) \otimes_{k} K \to \mathcal{O}(U \times_{k} K) $$ may not be surjective if $U$ is not quasi-compact. (This is essentially same example given by Najib Idrissi in Tensor products over field do not commute with inverse limits?.) Let $k$ be a field and set $K := k(\{t_{n}\}_{n \in \mathbb{Z}})$; here $K/k$ is a field extension of countably infinite transcendence degree. Set $U := \amalg_{n \in \mathbb{Z}} \operatorname{Spec} k$; then $U \times_{k} K \simeq \amalg_{n \in \mathbb{Z}} \operatorname{Spec} K$ and $\mathcal{O}(U) = \prod_{n \in \mathbb{Z}} k$ and $\mathcal{O}(U \times_{k} K) = \prod_{n \in \mathbb{Z}} K$. The inclusion $k \to K$ gives a canonical inclusion $\prod_{n \in \mathbb{Z}} k \to \prod_{n \in \mathbb{Z}} K$ of $k$-algebras, where $k$ acts diagonally; then base change induces the desired morphism \begin{align*} \textstyle \varphi : (\prod_{n \in \mathbb{Z}} k) \otimes_{k} K \to \prod_{n \in \mathbb{Z}} K \end{align*} of $K$-algebras. We show that $\varphi$ is not surjective. The image of $\varphi$ consists of elements of the form $\alpha = \sum_{i=1}^{\ell} (\mathbf{a}_{i} \otimes x_{i})$ with $\mathbf{a}_{i} \in \prod_{n \in \mathbb{Z}} k$ and $x_{i} \in K$. Then $\alpha \in \prod_{n \in \mathbb{Z}} F$ where $F$ is the finitely generated subextension $F = k(x_{1},\dotsc,x_{\ell})$ of $K/k$. Thus for example the element $(t_{n})_{n \in \mathbb{Z}} \in \prod_{n \in \mathbb{Z}} K$ is not contained in the image of $\varphi$.
