I've identified one new "issue".
There is an implicit assumption that primary keys are useful for
ordering by the current QuerySet API methods `.first()` and `.last()`.

I believe the case here is that first and last are meaningless without an ordering, so in lieu of any programmer supplied ordering, a "fallback" consistent ordering of 'pk' is used.

Remember the DBMS is under no obligation to return a query in consistent order without an ORDER BY clause.

So, without an ordering, two successive calls to first() [or last()] may, in fact, return different records even without modifications to the table.

It's not expected people should _rely_ on the ordering of PK, and, indeed, it's frequently recommended against inferring any meaning from PK values [sqlite, IIRC, assigns them pseudo-ramdomly]

That said, the assumption that a PK is sortable and will provide a deterministic ordering shouldn't be much to ask, surely?

--
Curtis

--
You received this message because you are subscribed to the Google Groups "Django 
developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/567353FA.6030105%40tinbrain.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to