Opened 22 hours ago

Closed 13 hours ago

#36852 closed Bug (fixed)

postgres.contrib.ExclusionContraint __eq__ incorrectly considers index_type case

Reported by: haki Owned by: haki
Component: contrib.postgres Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The equality check for ExclusionContraint in postgres.contrib.ExclusionContraint stores the index_type in the provided case, but the equality check compares the string without normalizing the case.

Unlike other props like condition where case might be important, the case of index_type (currently 'gist', 'spgist', and soon 'hash') is not significant, therefor should be ignored in equality checks.

Change History (6)

comment:2 by haki, 22 hours ago

Has patch: set

comment:3 by Clifford Gama, 19 hours ago

Component: Database layer (models, ORM)contrib.postgres
Triage Stage: UnreviewedAccepted

Thanks for the report!

comment:4 by Clifford Gama, 18 hours ago

Triage Stage: AcceptedReady for checkin

comment:5 by Jacob Walls, 14 hours ago

I confirmed that changing an index_type from spgist to SPGIST no longer creates a migration after this proposed change. Changes between gist and GIST were already a no-op given how deconstruct() handles the default value:

    def deconstruct(self):
...
        if self.index_type.lower() != "gist":
            kwargs["index_type"] = self.index_type

comment:6 by Jacob Walls <jacobtylerwalls@…>, 13 hours ago

Resolution: fixed
Status: assignedclosed

In 459a3d17:

Fixed #36852 -- Ignored index_type case in ExclusionConstraint equality check.

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