[Django] #32714: Model meta ordering with nulls_last resulting in constantly needing new migrations

28 views
Skip to first unread message

Django

unread,
May 4, 2021, 3:44:43 PM5/4/21
to django-...@googlegroups.com
#32714: Model meta ordering with nulls_last resulting in constantly needing new
migrations
---------------------------------------+------------------------
Reporter: Kevin Marsh | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 3.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------+------------------------
Just upgraded from Django 3.2. to 3.2.1 and now `makemigrations` always
shows the same change. The issue seems to be if you have:

{{{
class SampleModel(models.Model):

name = models.CharField(null=True, max_length=255)

class Meta:
ordering = [F('name').asc(nulls_last=True)]

}}}
Running `makemigrations` always results in the ordering changing for
`SampleModel`, think maybe this was introduced when trying to solve #32632
since for:
{{{
a = F('name').asc(nulls_last=True)
b = F('name').asc(nulls_last=True)
}}}
In Django 3.2 `a == b` but in Django 3.2.1 `a != b`

--
Ticket URL: <https://code.djangoproject.com/ticket/32714>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 4, 2021, 5:16:23 PM5/4/21
to django-...@googlegroups.com
#32714: Model meta ordering with nulls_last resulting in constantly needing new
migrations
-------------------------------------+-------------------------------------
Reporter: Kevin Marsh | Owner: Simon
| Charette
Type: Bug | Status: assigned
Component: Migrations | Version: 3.2
Severity: Release blocker | Resolution:

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):

* owner: nobody => Simon Charette
* status: new => assigned
* severity: Normal => Release blocker


Comment:

Likely introduced by
https://github.com/django/django/commit/c8b659430556dca0b2fe27cf2ea0f8290dbafecd
#diff-
359ab56295cce36b9597e1d65185f695f271955617b40f43df58ce3fe76fd0c8R1195

--
Ticket URL: <https://code.djangoproject.com/ticket/32714#comment:1>

Django

unread,
May 4, 2021, 5:54:04 PM5/4/21
to django-...@googlegroups.com
#32714: Model meta ordering with nulls_last resulting in constantly needing new
migrations
-------------------------------------+-------------------------------------
Reporter: Kevin Marsh | Owner: Simon
| Charette
Type: Bug | Status: assigned
Component: Migrations | Version: 3.2
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):

* has_patch: 0 => 1
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/32714#comment:2>

Django

unread,
May 5, 2021, 2:17:30 AM5/5/21
to django-...@googlegroups.com
#32714: Model meta ordering with nulls_last resulting in constantly needing new
migrations
-------------------------------------+-------------------------------------
Reporter: Kevin Marsh | Owner: Simon
| Charette
Type: Bug | Status: assigned
Component: Migrations | Version: 3.2
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/32714#comment:3>

Django

unread,
May 5, 2021, 2:44:41 AM5/5/21
to django-...@googlegroups.com
#32714: Model meta ordering with nulls_last resulting in constantly needing new
migrations
-------------------------------------+-------------------------------------
Reporter: Kevin Marsh | Owner: Simon
| Charette
Type: Bug | Status: closed
Component: Migrations | Version: 3.2
Severity: Release blocker | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"96f55ccf798c7592a1203f798a4dffaf173a9263" 96f55ccf]:
{{{
#!CommitTicketReference repository=""
revision="96f55ccf798c7592a1203f798a4dffaf173a9263"
Fixed #32714 -- Prevented recreation of migration for Meta.ordering with
OrderBy expressions.

Regression in c8b659430556dca0b2fe27cf2ea0f8290dbafecd.

Thanks Kevin Marsh for the report.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/32714#comment:4>

Django

unread,
May 5, 2021, 2:45:01 AM5/5/21
to django-...@googlegroups.com
#32714: Model meta ordering with nulls_last resulting in constantly needing new
migrations
-------------------------------------+-------------------------------------
Reporter: Kevin Marsh | Owner: Simon
| Charette
Type: Bug | Status: closed
Component: Migrations | Version: 3.2

Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"364098fdac597d2293d844d81ab523c22ca5a361" 364098fd]:
{{{
#!CommitTicketReference repository=""
revision="364098fdac597d2293d844d81ab523c22ca5a361"
[3.2.x] Fixed #32714 -- Prevented recreation of migration for
Meta.ordering with OrderBy expressions.

Regression in c8b659430556dca0b2fe27cf2ea0f8290dbafecd.

Thanks Kevin Marsh for the report.

Backport of 96f55ccf798c7592a1203f798a4dffaf173a9263 from main
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/32714#comment:5>

Django

unread,
May 5, 2021, 3:58:41 AM5/5/21
to django-...@googlegroups.com
#32714: Model meta ordering with nulls_last resulting in constantly needing new
migrations
-------------------------------------+-------------------------------------
Reporter: Kevin Marsh | Owner: Simon
| Charette
Type: Bug | Status: closed
Component: Migrations | Version: 3.2

Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Johannes Maron):

Mariusz, any chance to speed up release. I'm having trouble to apply the
patch for CVE-2021-31542 without this change. And seeing that the patch
for CVE-2021-31542 is rather large, I don't really want to backport it.

--
Ticket URL: <https://code.djangoproject.com/ticket/32714#comment:6>

Django

unread,
May 5, 2021, 4:00:53 AM5/5/21
to django-...@googlegroups.com
#32714: Model meta ordering with nulls_last resulting in constantly needing new
migrations
-------------------------------------+-------------------------------------
Reporter: Kevin Marsh | Owner: Simon
| Charette
Type: Bug | Status: closed
Component: Migrations | Version: 3.2

Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak):

Johannes, a set of releases will be issued tomorrow.

--
Ticket URL: <https://code.djangoproject.com/ticket/32714#comment:7>

Django

unread,
May 5, 2021, 4:08:52 AM5/5/21
to django-...@googlegroups.com
#32714: Model meta ordering with nulls_last resulting in constantly needing new
migrations
-------------------------------------+-------------------------------------
Reporter: Kevin Marsh | Owner: Simon
| Charette
Type: Bug | Status: closed
Component: Migrations | Version: 3.2

Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Johannes Maron):

* cc: Johannes Maron (added)


Comment:

👍

--
Ticket URL: <https://code.djangoproject.com/ticket/32714#comment:8>

Reply all
Reply to author
Forward
0 new messages