#29622: Indexes on JSONB paths fail system checks in 2.1
--------------------------------------+------------------------------------
Reporter: James Howe | Owner: nobody
Type: Bug | Status: new
Component: Core (System checks) | Version: 2.1
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Comment (by Josh Schneier):
How did this ever work & what version of Django are you upgrading from?
`set_name_with_model` uses `._meta.get_field` which would fail but I see
you've worked around that by explicitly naming your index; however
`create_sql` uses the same logic.
I was able to get the system check to pass & the migration to generate by:
splitting on `LOOKUP_SEP`, checking if it's a `JSONField`, and ensuring
that none of the lookup paths is in `.get_lookups`. Attempting to apply
the migration failed because of the aforementioned issues in
`.create_sql`. Obviously that also required importing `JSONField` which is
a no-go.
I think one approach to fixing this is an `Index` subclass that works
specifically for `JSONField` since it is pretty different, happy to work
on it if that sounds reasonable but I'll let someone else more familiar
with the system take a look . We'd have to call this previous behavior
unsupported I think.
--
Ticket URL: <https://code.djangoproject.com/ticket/29622#comment:3>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.45b1637e68d896419b4d98f1faa5be84%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.