mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #31709 -- Added support for opclasses in ExclusionConstraint.
This commit is contained in:
parent
dcb4d79ef7
commit
0d6d4e78b1
4 changed files with 179 additions and 5 deletions
|
@ -12,7 +12,7 @@ PostgreSQL supports additional data integrity constraints available from the
|
|||
``ExclusionConstraint``
|
||||
=======================
|
||||
|
||||
.. class:: ExclusionConstraint(*, name, expressions, index_type=None, condition=None, deferrable=None, include=None)
|
||||
.. class:: ExclusionConstraint(*, name, expressions, index_type=None, condition=None, deferrable=None, include=None, opclasses=())
|
||||
|
||||
Creates an exclusion constraint in the database. Internally, PostgreSQL
|
||||
implements exclusion constraints using indexes. The default index type is
|
||||
|
@ -121,6 +121,28 @@ used for queries that select only included fields
|
|||
|
||||
``include`` is supported only for GiST indexes on PostgreSQL 12+.
|
||||
|
||||
``opclasses``
|
||||
-------------
|
||||
|
||||
.. attribute:: ExclusionConstraint.opclasses
|
||||
|
||||
.. versionadded:: 3.2
|
||||
|
||||
The names of the `PostgreSQL operator classes
|
||||
<https://www.postgresql.org/docs/current/indexes-opclass.html>`_ to use for
|
||||
this constraint. If you require a custom operator class, you must provide one
|
||||
for each expression in the constraint.
|
||||
|
||||
For example::
|
||||
|
||||
ExclusionConstraint(
|
||||
name='exclude_overlapping_opclasses',
|
||||
expressions=[('circle', RangeOperators.OVERLAPS)],
|
||||
opclasses=['circle_ops'],
|
||||
)
|
||||
|
||||
creates an exclusion constraint on ``circle`` using ``circle_ops``.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue