#35977: Serializing ManyToMany fields produces inconsistent order (on Postgres)
-------------------------------------+-------------------------------------
     Reporter:  Alexander Todorov    |                    Owner:  (none)
         Type:  New feature          |                   Status:  closed
    Component:  Core                 |                  Version:  5.1
  (Serialization)                    |
     Severity:  Normal               |               Resolution:  wontfix
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Simon Charette):

 Agree with Sarah here!

 The lack of ordering consistency when retrieving objects from the database
 **without an explicit ordering** is not specified is not a Postgres or
 serialization specific problem.

 When no `ORDERY BY` is specified the database can choose to return values
 in the order it wants which is usually the fastest one. In the case of
 database like MySQL that usually means by primary key as that's how the
 data is clustered/organized on disk while on Postgres it depends on
 multiple factors.

 The patch you are proposing would be backward incompatible for two reasons

 1. It would change the order of serialized data for models that explicitly
 opted-in into a particular order
 2. The systematic order by primary key could slow down serialization of
 projects that don't care about ordering of data

 In other words, database don't return data in a stable order unless you
 explicitly ask for it and Django provides a way to do so through through
 `Meta.ordering` and manager overrides `order_by`.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35977#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/010701939c91d4c6-f626af4c-caa5-4583-85dd-67e6c1b1b39b-000000%40eu-central-1.amazonses.com.

Reply via email to