The reason is because we're not looking up the value of the sort field for the record identified by the marker. Instead, we're always adding a WHERE uuid > $MARKER clause. Instead, we need to add a WHERE $SORTFIELD > $MARKER_RECORD_VALUE_FOR_SORTFIELD expression.
The resulting WHERE expression for sorts on non-unique fields also needs to include the UUID to determine ties, and the ORDER BY clause needs to include a secondary order on uuid.
If the sort is on a field that is not unique, such as name, then the marker part of the query isn't correct. Example here:
The reason is because we're not looking up the value of the sort field for the record identified by the marker. Instead, we're always adding a
WHERE uuid > $MARKER
clause. Instead, we need to add aWHERE $SORTFIELD > $MARKER_RECORD_VALUE_FOR_SORTFIELD
expression.