Interchanging Derivative and Integral Example In class the other day, my professor stated the following theorem:

Suppose $\frac{d}{dy}f(x,y)$ is continuous on $[0,1] \times [0,1]$, then $\frac{d}{dy} \int^1_0 f(x,y) \, dx = \int_0^1 \frac{d}{dy}f(x,y) \, dx$.

He then quickly corrected this to read:

Suppose $\frac{d}{dy}f(x,y)$ and f are continuous on $[0,1] \times [0,1]$, then $$\frac{d}{dy} \int^1_0 f(x,y) \, dx = \int_0^1 \frac{d}{dy}f(x,y) \, dx.$$

I was wondering if anyone could provide an example of $f$ which satisfies the conditions for the first statement written but not the subsequently added continuity condition from the second statement, and therefore fails the overall implication of the first statement.

Let $\mathbb{Q}$ be the set of rational numbers. Define $f:[0,1]^2 \to \mathbb{R}$ by 
$$f(x,y) = \chi_{\mathbb{Q}}(x)= \begin{cases} 1 & x \in \mathbb{Q}\cap[0,1] \\ 0 & x \in [0,1] \setminus \mathbb{Q} \end{cases},$$
i.e., $f(x,y)$ is $1$ if $x$ is rational and $0$ if $x$ is irrational. 
Then $\frac{\partial f}{\partial y} \equiv 0$ and is therefore continuous ($f$ is constant with respect to $y$). As such, 
 $$\int_0^1 \frac{\partial f}{\partial y} ~\mathrm{d} x =0.$$
However, the integral term in 
$$\frac{d}{dy} \int_0^1 f(x,y)~\mathrm{d}x$$
is not even defined. Well, at least for the Riemann Integral$\dots$
