#34107: Django ORM queries do not pick up indexes made on a key in JSONField in
Postgres
-------------------------------------+-------------------------------------
Reporter: Tadek Teleżyński | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: 3.2
(models, ORM) |
Severity: Normal | Resolution: invalid
Keywords: json, jsonfield, | Triage Stage:
postgres, index | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Mariusz Felisiak):
> I couldn't figure out a syntax for the {{{fields}}} key when I want to
do an index on a key inside the json structure.
> {{{
> BTreeIndex(fields=['data__category'])
> }}}
> won't do...
`BTreeIndex` supports expressions, so you can use
`BTreeIndex(F("data__category"), name="...")`.
--
Ticket URL: <https://code.djangoproject.com/ticket/34107#comment:5>
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 view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070183f21991dd-d9827d75-aa44-41e6-b532-985d9b09b6af-000000%40eu-central-1.amazonses.com.