#36750: dumpdata's output of m2m values is not deterministic
--------------------------------------+------------------------------------
Reporter: Jacob Walls | Owner: (none)
Type: Bug | Status: new
Component: Core (Serialization) | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Simon Charette):
* stage: Unreviewed => Accepted
Comment:
@Jacob
> get the default ordering from somewhere better (through model? target
model?), instead of hardcoding "pk"
Since the objects will be filtered by `from_model_id = ?` I think that
ordering by `to_model_id` (AKA ''target model'') is a good candidate.
@VIZZARD-X
> Given this, I’m unable to reproduce the nondeterministic M2M natural key
ordering on the latest code. It appears the issue may already have been
resolved by recent changes in the serializers or related refactors.
It might be finicky to reproduce as it entirely depends on the order the
database decides to returns objects which is backend dependent.
> `python tests/runtests.py fixtures --shuffle 7825542710
--settings=tests.test_sqlite -k forward -v2`
The report explicitly state that the issue was reproduced against Postgres
(see `--settings=test_postgres`) and you tried reproducing agaisnt SQLite
so this is highly likely why you can't reproduce. In most cases SQLite
will objects in their order of creation while in the case of Postgres more
factors come into play.
> Given this, I’m unable to reproduce the nondeterministic M2M natural key
ordering on the latest code. It appears the issue may already have been
resolved by recent changes in the serializers or related refactors.
Which recent changes are you referring to? The problem was observed less
than a day ago (see ticket creation date) and no change to serialization
ordering landed on `main` since then.
--
Ticket URL: <https://code.djangoproject.com/ticket/36750#comment:2>
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/0107019aac119179-0bda6b86-906f-4ab0-b159-6adbeea6489d-000000%40eu-central-1.amazonses.com.