TITLE: Is an integer a sum of two rational squares iff it is a sum of two integer squares?
QUESTION [10 upvotes]: Let $a\in \mathbb Z$. Is it true that $a$ is a sum of two squares of rational numbers if and only if it is a sum of two squares of integers?
I came to face this problem while dealing with quaternion algebras.

REPLY [3 votes]: Given your choice of language, I think you had best also look at some articles about when an (integral) quadratic form has Pete L. Clark's ADC property, which is exactly what you quote: it represents a number integrally if and only if it represents the number rationally.
These would be the items in his publications page numbered 15, 15D, and 28.  
Meanwhile, from article [28], there are 764 known positive binary quadratic forms with your property. There are exactly 103 ternary forms that do this. In those dimensions, there are just a handful of forms that satisfy the "Euclidean" condition, given (positive) form $f(\vec{x}),$ for any point $\vec{x}$ in $\mathbb R^n,$ there is at least one point $\vec{p} \in \mathbb Z^n$ such that $f(\vec{x} - \vec{p}) < 1.$ Theorem 8 in item [15] is the proof that the Euclidean property implies the ADC property. The technique goes back to Aubry, but is usually attributed to Davenport-Cassels. Very simple trick.
Out of the 764 ADC binary forms, the primitive ones that also are Euclidean (so that the Aubry trick proves your property) are 
$$ x^2 + xy+ y^2, x^2 + y^2,x^2 + xy+ 2y^2,  x^2 + 2y^2,  $$
$$ 2x^2 + xy+ 2y^2, x^2 + xy+ 3y^2,  2x^2 +2xy + 3y^2.  $$
Pete would want me to mention indefinite forms. The revised Euclidean condition is $0 < |f(\vec{x} - \vec{p})| < 1.$ There are a bit over a dozen indefinite binary forms that satisfy this; most are principal, but about three are non-principal; Lenstra's idea, he called these "Euclidean Ideal Classes."  Meanwhile, I imagine there are infinitely many indefinite ADC binary forms. I know there are infinitely many indefinite ternary, such as $xy-Tz^2$ for fixed nonzero integer $T.$