  Oxide heterostructures are of great interest both for fundamental and
applicative reasons. In particular the two-dimensional electron gas at the
LaAlO$_3$/SrTiO$_3$ or LaTiO$_3$/SrTiO$_3$ interfaces displays many different
physical properties and functionalities. However there are clear indications
that the interface electronic state is strongly inhomogeneous and therefore it
is crucially relevant to investigate possible intrinsic electronic mechanisms
underlying this inhomogeneity. Here the electrostatic potential confining the
electron gas at the interface is calculated self-consistently, finding that the
electron confinement at the interface may induce phase separation, to avoid a
thermodynamically unstable state with a negative compressibility. This provides
a generic robust and intrinsic mechanism for the experimentally observed
inhomogeneous character of these interfaces.
