Opened 26 hours ago

Last modified 14 hours ago

#36694 assigned Bug

GistIndex with condition ignores condition — at Version 1

Reported by: Luciano de la Iglesia Owned by:
Component: GIS Version: 5.2
Severity: Normal Keywords: postgis index condition include
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Luciano de la Iglesia)

I have this model:

class Foo(models.Model):
    location = geomodels.PointField(geography=True, spatial_index=False)
    is_current = models.BooleanField()

    class Meta:
        indexes = [
            GistIndex(fields=["location"], condition=Q(is_current=True), name="current_foo"),
        ]

When I create the migration, the sql for my current_foo index is:

CREATE INDEX "current_foo" ON "webatds_foo" USING GIST ("location");

This ignores my condition, I expect it to be:

CREATE INDEX "current_foo" ON "webatds_foo" USING GIST ("location") where is_current=true;

I'm using django 5.2.7, psycopg 3.2.12, and PostGIS 17.3.5.

Change History (1)

comment:1 by Luciano de la Iglesia, 26 hours ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top