Exercise III.2.1(b) Hartshorne: Isn't the restriction of a constant sheaf on a connected space to a connected subspace again constant? Consider Exercise III.2.1(b) in Hartshorne: Let $X=\mathbb{A}_k^n$ for $n\geq 2$ and an infinite field $k$, and let $Y\subseteq X$ be the union of $n+1$ hyperplanes in general position. Let $U=X\setminus Y$, and denote by $\underline{\mathbb{Z}}$ the constant sheaf on $X$, and also $\underline{\mathbb{Z}}_U:=j_{!}(j^{-1}\underline{\mathbb{Z}})$ as well as $\underline{\mathbb{Z}}_Y:=i_{*}(i^{-1}\underline{\mathbb{Z}})$, where $j:U\to X$ and $i:Y\to X$ are the inclusion maps. Then show that $H^n(X,\underline{\mathbb{Z}}_U)\neq 0$.
Now I'm confused: consider the sheaf $i^{-1}\underline{\mathbb{Z}}$ on $Y$. By definition, this is the sheaf associated to the presheaf $i^{-1,pre}\underline{\mathbb{Z}}$ defined by
$$
i^{-1,pre}\underline{\mathbb{Z}}(W)=\lim_{\substack{V\subseteq_{\text{open}} X \\ W\subseteq V}}\underline{\mathbb{Z}}(V).
$$
But now as $X$ is irreducible, we have $\underline{\mathbb{Z}}(V)=\mathbb{Z}$ for all non-empty $V$, and the restriction maps are just the identity, so $i^{-1,pre}\underline{\mathbb{Z}}(W)=\mathbb{Z}$ for all non-empty $W$. But now as $Y$ is connected for $n\geq 2$, this is in fact already a sheaf, namely the constant sheaf associated to $\mathbb{Z}$ on $Y$. But then this is flasque, so the higher cohomology groups vanish, which gives me $H^n(X,\underline{\mathbb{Z}}_U)=0$. Where am I going wrong?
 A: I think the issue is that the answer to your question in the title is negative, since it's irreducibility that you're really interested in to argue that this sheaf is flasque. Explicitly, if you take the union of the $x$ and $y$ axes in the affine plane $Y=V(xy) \subseteq \mathbf{A}^2_k$ and the constant sheaf $\underline{\mathbf{Z}} \in \text{Sh}_{\text{Ab}}(Y)$ (which is the restriction of the constant sheaf $\underline{\mathbf{Z}}$ on $\mathbf{A}^2_k$ to $X$) then the global sections are given by $\Gamma(Y,\underline{\mathbf{Z}}) = \mathbf{Z}$ since $Y$ is connected, but $Y$ has the disconnected open subset $U = D(x) \cup D(y) \subseteq Y$. You can see $U$ is disconnected by the equality $$
   D(x) \cap D(y) = D(xy) = \emptyset
$$ or by just checking that $U$'s global sections are given by the equaliser $$
   \text{eq}(k[x,x^{-1}] \times k[y,y^{-1}] \rightrightarrows (0)) = k[x,x^{-1}] \times k[y,y^{-1}]
$$ which has precisely two non-trivial idempotents - this implies $\Gamma(U,\underline{\mathbf{Z}}) = \mathbf{Z} \oplus \mathbf{Z}$ and thus the restriction map $$
   \Gamma(Y,\underline{\mathbf{Z}}) \to \Gamma(U,\underline{\mathbf{Z}})
$$ can't be surjective.
Hope this helps :)
