Throw error when SQL interfaced data are not sorted