Opened 5 years ago
Closed 5 years ago
#31709 closed New feature (fixed)
Support operator classes for exclusion constraints.
| Reported by: | Hannes Ljungberg | Owned by: | Hannes Ljungberg |
|---|---|---|---|
| Component: | contrib.postgres | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
ExclusionConstraint should allow setting opclasses just like Index:
class Meta:
constraints = [
ExclusionConstraint(
name='exclude_overlapping'',
expressions=[('circle', RangeOperators.OVERLAPS),
opclasses=['circle_ops'],
)
]
There are not many choices over the default operator classes on GiST and SP-GiST indexes. I think the only one is for point where one can choose between quad_point_ops and kd_point_ops. But users can also create custom operator classes. I think it makes sense to also provide this option on ExclusionConstraint for consistency.
I've also created https://code.djangoproject.com/ticket/31702 to add opclasses to UniqueConstraint.
Change History (3)
comment:1 by , 5 years ago
| Summary: | Allow specifying custom operator classes for PostgreSQL exclusion constraints → Support operator classes for exclusion constraints. |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
comment:2 by , 5 years ago
| Has patch: | set |
|---|
PR: https://github.com/django/django/pull/13067