Pullback of Cartier divisors

Let $f:X \to Y$ be a morphism of schemes (not necessarily reduced). Assume $X$ is smooth and $f$ is locally a homeomorphism. Let $D$ be a Cartier divisor on $Y$. We know that the pullback $f^*(D)$ is again a Cartier divisor. If $f^*(D)$ is effective then is it true that $D$ is effective?

The answer is no in general, but maybe you could put more conditions on $X$ and $Y$ so that it is true. Take $Y$ to be any variety, let $D_1,D_2\subseteq Y$ be subvarieties of codimension 1, and let $D=D_1-D_2$. If we take $X=Y\backslash D_2$, then the pullback of $D$ to $X$ is just $D_1$, which is effective.
Edit If $f$ is surjective, then it's true. If $D=F_1-F_2$, with $F_1$ and $F_2$ effective divisors that have no common components, then $f^*D=f^*F_1-f^*F_2$. Since this is effective, we have that $f^*F_2$ appears in $f^*F_1$. Locally at a point $x\in X$, $f^*F_1$ is of the form $g\circ f=0$, where $g$ is a regular function at $f(x)$ defining $F_1$. Moreover, we have that if $F_2$ is given locally by $h=0$ at $f(x)$, then $h\circ f\mid g\circ f$ in the local ring $\mathcal{O}_{X,x}$. If $U$ is an affine neighborhood of $x$ and $V$ is its image, then we can assume that $U$ and $V$ are homeomorphic, and so $h\mid g$. But then $F_2$ appears in $F_1$, a contradiction. Therefore $F_2$ must be equal to $0$.
• @Auffarth: Please note $f$ is locally a homeomorphism. In your example I do not see how $f$ can be a homeomorphism. – Chen Sep 1 '13 at 21:39
• In this example $f$ is locally the identity! Actually $f$ is the identity and so is a homeomorphism with its image, which is an open subset of $Y$! – rfauffar Sep 1 '13 at 22:43
• By locally a homeomorphism, I mean for every point of $Y$ there exists an open neighbourhood containing that point such that it is homeomorphic to its preimage. I guess this is not the conventional definition. Sorry for the confusion. – Chen Sep 2 '13 at 1:05