Opened 2 hours ago

Last modified 20 minutes ago

#36660 assigned Bug

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: Accepted
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 (2)

comment:1 by Simon Charette, 24 minutes 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, 20 minutes ago

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