[Django] #36852: postgres.contrib.ExclusionContraint __eq__ incorrectly considers index_type case

12 views
Skip to first unread message

Django

unread,
Jan 8, 2026, 3:04:20 AMJan 8
to django-...@googlegroups.com
#36852: postgres.contrib.ExclusionContraint __eq__ incorrectly considers index_type
case
-------------------------------------+-------------------------------------
Reporter: haki | Owner: haki
Type: Bug | Status: assigned
Component: Database | Version: dev
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/36852>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 8, 2026, 3:09:22 AMJan 8
to django-...@googlegroups.com
#36852: postgres.contrib.ExclusionContraint __eq__ incorrectly considers index_type
case
-------------------------------------+-------------------------------------
Reporter: haki | Owner: haki
Type: Bug | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by haki):

PR link [https://github.com/django/django/pull/20510]
--
Ticket URL: <https://code.djangoproject.com/ticket/36852#comment:1>

Django

unread,
Jan 8, 2026, 3:09:40 AMJan 8
to django-...@googlegroups.com
#36852: postgres.contrib.ExclusionContraint __eq__ incorrectly considers index_type
case
-------------------------------------+-------------------------------------
Reporter: haki | Owner: haki
Type: Bug | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by haki):

* has_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36852#comment:2>

Django

unread,
Jan 8, 2026, 5:34:06 AMJan 8
to django-...@googlegroups.com
#36852: postgres.contrib.ExclusionContraint __eq__ incorrectly considers index_type
case
----------------------------------+------------------------------------
Reporter: haki | Owner: haki
Type: Bug | Status: assigned
Component: contrib.postgres | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+------------------------------------
Changes (by Clifford Gama):

* component: Database layer (models, ORM) => contrib.postgres
* stage: Unreviewed => Accepted

Comment:

Thanks for the report!
--
Ticket URL: <https://code.djangoproject.com/ticket/36852#comment:3>

Django

unread,
Jan 8, 2026, 6:53:56 AMJan 8
to django-...@googlegroups.com
#36852: postgres.contrib.ExclusionContraint __eq__ incorrectly considers index_type
case
-------------------------------------+-------------------------------------
Reporter: haki | Owner: haki
Type: Bug | Status: assigned
Component: contrib.postgres | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Clifford Gama):

* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/36852#comment:4>

Django

unread,
Jan 8, 2026, 10:57:49 AMJan 8
to django-...@googlegroups.com
#36852: postgres.contrib.ExclusionContraint __eq__ incorrectly considers index_type
case
-------------------------------------+-------------------------------------
Reporter: haki | Owner: haki
Type: Bug | Status: assigned
Component: contrib.postgres | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Jacob Walls):

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:

{{{#!py
def deconstruct(self):
...
if self.index_type.lower() != "gist":
kwargs["index_type"] = self.index_type
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36852#comment:5>

Django

unread,
Jan 8, 2026, 11:34:02 AMJan 8
to django-...@googlegroups.com
#36852: postgres.contrib.ExclusionContraint __eq__ incorrectly considers index_type
case
-------------------------------------+-------------------------------------
Reporter: haki | Owner: haki
Type: Bug | Status: closed
Component: contrib.postgres | Version: dev
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls <jacobtylerwalls@…>):

* resolution: => fixed
* status: assigned => closed

Comment:

In [changeset:"459a3d17b973df23fc45328d4e976a270f0edd7f" 459a3d17]:
{{{#!CommitTicketReference repository=""
revision="459a3d17b973df23fc45328d4e976a270f0edd7f"
Fixed #36852 -- Ignored index_type case in ExclusionConstraint equality
check.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36852#comment:6>
Reply all
Reply to author
Forward
0 new messages