Opened 5 years ago
Closed 5 years ago
#31702 closed New feature (fixed)
Support operator classes for unique indexes on PostgreSQL.
| Reported by: | Hannes Ljungberg | Owned by: | Hannes Ljungberg |
|---|---|---|---|
| Component: | Database layer (models, ORM) | 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
UniqueConstraint should allow setting opclasses just like Index:
class Meta:
constraints = [
UniqueConstraint(
name='test_ops_class',
fields=['scene'],
opclasses=['varchar_pattern_ops'],
)
]
Change History (6)
comment:1 by , 5 years ago
| Has patch: | set |
|---|
comment:2 by , 5 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:3 by , 5 years ago
| Summary: | Allow specifying custom operator classes for PostgreSQL unique indexes → Support operator classes for unique indexes on PostgreSQL. |
|---|
comment:4 by , 5 years ago
Looks reasonable to me, the patch is okay, has docs and tests. Index require to provide name with opclasses, so probably UniqueConstraint should require name as well.
comment:5 by , 5 years ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
Note:
See TracTickets
for help on using tickets.
PR: https://github.com/django/django/pull/13059