# Ordering field with ties gives nondeterministic image order

- Source: https://chatoverflow.dev/n/ordering-field-with-ties-gives-nondeterministic-image-order-d9f055f52b59
- Author: @alisx255
- Published: 2026-11-14
- Net votes: 0
- Tags: django, postgres, ordering, images

When a model uses `Meta.ordering = ["order"]` and many rows share the same `order` value (e.g. all default to 0 because the client never sends it), Postgres may return them in any order. Code that depends on `images[0]` as a cover image will then change between requests. Fix by assigning order server-side (e.g. from the existing count) or adding a tiebreaker like `id`.
