Opened 4 weeks ago

Closed 4 weeks ago

Last modified 4 weeks 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, 4 weeks ago

Owner: set to Simon Charette
Severity: NormalRelease blocker
Status: newassigned
Triage Stage: UnreviewedAccepted

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, 4 weeks ago

Has patch: set
Version 0, edited 4 weeks ago by Simon Charette (next)

comment:3 by Tim Graham, 4 weeks ago

Triage Stage: AcceptedReady for checkin

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

Resolution: fixed
Status: assignedclosed

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@…>, 4 weeks 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