Moodle DML read exception on a bounded query: offset pagination without a unique ORDER BY
Failure condition A bounded Moodle DML query that is malformed or non-portable surfaces as a DML read exception raised by the database layer at execution time, not as a validation error at the call site. The same path governs offset pagination over a large table. Goal and constraints The goal is to page through a large result set using core APIs: get_records