Re: [Django] #36694: PostGIS backend silently ignores most Index options (expressions, condition, include, opclasses) (was: GistIndex with condition ignores condition)

1 view
Skip to first unread message

Django

unread,
Oct 28, 2025, 10:36:17 PM10/28/25
to django-...@googlegroups.com
#36694: PostGIS backend silently ignores most Index options (expressions,
condition, include, opclasses)
-------------------------------------+-------------------------------------
Reporter: Luciano de la | Owner: (none)
Iglesia |
Type: Bug | Status: new
Component: GIS | Version: 5.2
Severity: Normal | Resolution:
Keywords: postgis index | Triage Stage: Accepted
condition include |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):

* component: Migrations => GIS
* keywords: => postgis index condition include
* stage: Unreviewed => Accepted
* summary: GistIndex with condition ignores condition =>
PostGIS backend silently ignores most Index options (expressions,
condition, include, opclasses)

Comment:

Confirmed this is a bug in in `django.contrib.gis.db.backends.postgist` (I
inferred you were using PostGIS given you use
`contrib.postgres.ArrayField`).

The `SchemaEditor._create_index_sql` method delegates to
`._create_spatial_index_sql` to provide some defaults (e.g. `opclasses`)
but fails to pass along `kwargs` such as `condition`, `include`,
`expressions`, etc.
[https://github.com/django/django/blob/43933a1dca07047e95ec990d9289d0212668009e/django/contrib/gis/db/backends/postgis/schema.py#L98-L121
It seems broken in multiple ways].
--
Ticket URL: <https://code.djangoproject.com/ticket/36694#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Reply all
Reply to author
Forward
0 new messages