postgresql - paginate correctly ordering by non-distinct values?
I believe the simplest solution is to sort on multiple columns (the one(s) you need for your basic sort, plus another column (or set of columns) that would make the effective "key" of your query unique).

This is more difficult (but may not be impossible) if your table(s) don't have a primary or unique key; you'd have to establish that there is a set of columns that could uniquely identify the rows you're presenting.