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:1 by , 22 hours ago
comment:2 by , 22 hours ago
| Has patch: | set |
|---|
comment:3 by , 19 hours ago
| Component: | Database layer (models, ORM) → contrib.postgres |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
Thanks for the report!
comment:4 by , 18 hours ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
comment:5 by , 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
PR link https://github.com/django/django/pull/20510