Opened 12 months ago

Closed 12 months ago

Last modified 12 months ago

#36660 closed Bug (fixed)

False-positive E012 check error when index contains descending order field

Reported by: Federico Bond Owned by: Simon Charette
Component: Database layer (models, ORM) Version: 6.0
Severity: Release blocker Keywords:
Cc: Federico Bond Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When a model has an index defined like this:

class Meta:
    indexes = [models.Index(fields=["foo", "-bar"])]

The system check framework in 6.0a1 will now report the following error:

foo.FooModel: (models.E012) 'indexes' refers to the nonexistent field '-bar'.

Tested with Django 6.0a1. This was not happening in 5.2. Might have something to do with these ​changes but I'm not sure.

Change History (5)

comment:1 by Simon Charette, 12 months ago

Owner: set to Simon Charette
Severity: Normal → Release blocker
Status: new → assigned
Triage Stage: Unreviewed → Accepted

Thank you for the report!

Confirmed to be a regression caused by 8638d8bf74c1a58302c97d4436ad2eb08438145b's (#36273) lack of fields_orders usage (​before and ​after) when calling _check_local_fields.

comment:2 by Simon Charette, 12 months ago

Has patch: set
Last edited 12 months ago by Tim Graham (previous) (diff)

comment:3 by Tim Graham, 12 months ago

Triage Stage: Accepted → Ready for checkin

comment:4 by nessita <124304+nessita@…>, 12 months ago

Resolution: → fixed
Status: assigned → closed

In edde2891:

Fixed #36660 -- Fixed a regression in descending Index local field checks.

Regression in 8638d8bf74c1a58302c97d4436ad2eb08438145b.

Refs #36273.

Thanks Federico Bond for the report.

comment:5 by Natalia <124304+nessita@…>, 12 months ago

In 86e7406c:

[6.0.x] Fixed #36660 -- Fixed a regression in descending Index local field checks.

Regression in 8638d8bf74c1a58302c97d4436ad2eb08438145b.

Refs #36273.

Thanks Federico Bond for the report.

Backport of edde2891c355103ba455f3fea95cff962e40962c from main.

Note: See TracTickets for help on using tickets.
Back to Top