Complement of codimension 1 subset of affine scheme not affine

Let $$X$$ be a Noetherian integral affine scheme. Let $$U\subset X$$ be an open subscheme whose complement has irreducible components of codimension $$1$$. Is $$U$$ affine?

Some remarks:

• By EGA 4, Cor. 21.12.7, the complement of a codimension 2 closed subset is not affine.
• if $$X$$ is the spectrum of a UFD, then I believe this can not happen. The ideal defining the complement has height 1. Thus the radical has height 1, so it is an intersection of prime ideals of height 1 so it is principal.
• if $$X$$ is of Krull dimension 1 (e.g. Dedekind domain), this can not happen.
• This note by Ravi Vakil gives an example of an affine variety $Z$ having an open set $Y$ with complement of codimension $1$ and such that the ring of global sections on $Y$ is not noetherian, and in particular, $Y$ is not affine. Apr 24, 2019 at 19:16
• @Gro-Tsen in the note it is stated that the algebra of global sections is not finitely generated. How does it follow that it is not Noetherian? For example, $k[[x]]$ is not finitely generated but it is Noetherian. Could you clarify?
– user138661
Apr 24, 2019 at 20:53
• Ah yes, there are various presentations of this counterexample. In Vakil's Foundations of Algebraic Geometry, exercise 19.11.H, the same example is given and it is stated that it is not noetherian… I'm afraid I can't remember why just now. On the other hand this note by Ojanguren (in French) gives a simpler example, with a proof of non-noetherianness… but without the assumption of integrality. Apr 24, 2019 at 22:24
• It may be worth asking the question under what conditions the converse of the implication “finite type ⇒ noetherian” holds. I realize I don't know whether a subalgebra of $k[t_1,\ldots,t_d]$ can be noetherian without being of finite type, for example. Apr 24, 2019 at 22:31
• FWIW, the user appears to have been part of a group of accounts controlled by the same individual Jun 24, 2019 at 3:12

Quoting from a paper by Roth and Vakil ($$\mathrm{cd}$$ stands for cohomological dimension):
Let $$S$$ be $$\mathbb{P}^2$$ blown up at a point, and let $$X$$ be the affine cone over some projective embedding of $$S$$. Let $$Z\subset X$$ be the affine cone over the exceptional divisor of the blowup. Then $$Z$$ is of codimension one in $$X$$, but $$\mathrm{cd}(X\backslash Z) = 1$$, so in particular it is not affine. This shows that, conversely, the complement of a Weil divisor in an affine scheme need not be affine...