It happens when another transaction commits a change between your two reads. PostgreSQL allows it at READ COMMITTED and prevents it at REPEATABLE READ.