TITLE: Factoriality: local or global?
QUESTION [13 upvotes]: Let $X$ be an algebraic variety.  I have read the following definitions:

$X$ is factorial if every Weil divisor on $X$ is Cartier.
$X$ is locally factorial if all its local rings are unique factorisation domains.

I am comfortable with each of these.  However, I have also seen it stated (in this question) or implied (in this answer to a related question) that these are equivalent, and I'm not sure about this.
For example, consider the local model for a threefold node, $\mathrm{Spec}\left( \mathbb{C}[x,y,z,w]/(xy - wz) \right)$.  Its local ring at the origin is not a UFD, as $xy = wz$.  This corresponds to the existence of non-Cartier divisors like $\{x = z = 0\}$.
But this singularity occurs in varieties which do not have non-Cartier divisors.  Consider, for example, the quintic threefold given by projectivising the equation ($xy - wz +$ generic terms up to order five) $=0$.  I know for a fact that this does not have non-Cartier divisors, yet it has a node.
So, are 1. and 2. really equivalent?  If so, the higher-order terms in the above example must restore factoriality of the local ring, right?  I'd been under the impression that such higher-order terms don't change the local structure; this might be where I've gone wrong.

REPLY [16 votes]: It's a standard result in commutative algebra that every noetherian integral domain is a UFD if and only if every prime ideal of height 1 is principal. When applied to the local rings of X this gives exactly the equivalence above.