If a measurable function $f$ has zero integral over every measurable set *of finite measure*, then $f=0$ a.e.? Let $X$ be a locally compact Hausdorff space, and let $\mu$ be a regular measure on $X$. Suppose that $g : X \to \Bbb C$ belongs to $L^{\infty}(X)$.
My question is :

Is it sufficient to assume that $\int_E g = 0$ for all Borel sets $E$ of finite measure (that is $\int_X fg = 0$ for all $f \in L^1(X)$) to conclude that $g=0$ a.e. ?

I know from questions like this one that this is true if we assume $\int_E g = 0$ for all Borel sets $E$.
Given a Borel set $E$ of infinite measure, maybe I can write it as a countable union of Borel sets of finite measure to use my hypothesis. (Or the answer to my question could be "no", but this would be annoying for me...)
Thank you very much for your help!
 A: If $X$ is not $\sigma$-finite, the answer is NO. Here is a simple example. 
Let $X=[0,1]$ with the usual topology. Let $\mu$ be defined on the Borel $\sigma$-algebra, by $\mu(\emptyset)=0$ and $\mu(E)=+\infty$ if $E\neq \emptyset$. 
It is easy to see that$\mu$ is a regular measure. Let $g$ be the constant function, $g=1$. 
We have $\int_E g = 0$ for all Borel sets $E$ of finite measure (because the only Borel set of finite measure is the empty set!)  and, it is clear that we can not conclude $g=0$ a.e. 
A: If $\mu$ is a Radon measure (which is not an inappropriate hypothesis for a measure on a locally compact Hausdorff space) then the assertion is true. To see this fix $\epsilon>0$ and define $B:=\{x\in X: g(x)>\epsilon\}$. Because $\mu$ is Radon there is a sequence $\{K_n\}$ of compact subsets of $B$ with $\sup_n\mu(K_n)=\mu(B)$. Because $K_n$ is compact, $\mu(K_n)<\infty$. Therefore
$$
0=\int_{K_n}g\,d\mu\ge \epsilon\mu(K_n).
$$
It follows that $\mu(B)=0$. Sending $\epsilon$ down to $0$ along a sequence, we obtain $\mu(\{x:g(x)>0\})=0$. Likewise, $\mu(\{x:g(x)<0\})=0$. That is, $g=0$, $\mu$-a.e.
