summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorHannes Ljungberg <hannes@5monkeys.se>2020-06-14 20:50:39 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-06-16 08:16:14 +0200
commit0d6d4e78b17d7500e1a503fd2b02fdcf822d9d3c (patch)
tree5490caec4e52639d2629d5af0141556438a503a4 /docs
parentdcb4d79ef719d824431a8b3ff8ada879bbab21cc (diff)
Fixed #31709 -- Added support for opclasses in ExclusionConstraint.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/contrib/postgres/constraints.txt24
-rw-r--r--docs/releases/3.2.txt3
2 files changed, 26 insertions, 1 deletions
diff --git a/docs/ref/contrib/postgres/constraints.txt b/docs/ref/contrib/postgres/constraints.txt
index fdc547265e..25e6ae5ae0 100644
--- a/docs/ref/contrib/postgres/constraints.txt
+++ b/docs/ref/contrib/postgres/constraints.txt
@@ -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
--------
diff --git a/docs/releases/3.2.txt b/docs/releases/3.2.txt
index 416530400e..6b2fb41144 100644
--- a/docs/releases/3.2.txt
+++ b/docs/releases/3.2.txt
@@ -73,6 +73,9 @@ Minor features
* The new :attr:`.ExclusionConstraint.include` attribute allows creating
covering exclusion constraints on PostgreSQL 12+.
+* The new :attr:`.ExclusionConstraint.opclasses` attribute allows setting
+ PostgreSQL operator classes.
+
* The new :attr:`.JSONBAgg.ordering` attribute determines the ordering of the
aggregated elements.