WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@Zsajk
Copy link

@Zsajk Zsajk commented Aug 29, 2025

Page-number pagination on several API list endpoints can return duplicate and missing rows because ordering is not deterministic (OrderingFilter was disabled and the queryset doesn’t enforce an order).

/api/sc/polity-territories/?page_size=100: API count = 606; fetched rows = 606; unique ids = 587 (19 duplicates). Duplicate ids vary across runs.

Change
Re-enable DRF filters.OrderingFilter and expose ordering_fields=['id']. This allows clients to request ?ordering=id, yielding deterministic, indexed ordering.

Zsajk and others added 2 commits August 29, 2025 14:26
Thanks Jakob for raising the issue, the solution is to add a consistent order_by('id') to the get_queryset calls, and the issue is now solved on the production API as well.
@Zsajk Zsajk closed this Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants