Fixed #29824 -- Added support for database exclusion constraints on PostgreSQL.

Thanks to Nick Pope and Mariusz Felisiak for review.

Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
This commit is contained in:
Mads Jensen 2019-07-12 13:08:00 +02:00 committed by Mariusz Felisiak
parent 7174cf0b00
commit a3417282ac
9 changed files with 589 additions and 4 deletions

View file

@ -944,3 +944,26 @@ corresponding lookups.
NOT_LT = '&>'
NOT_GT = '&<'
ADJACENT_TO = '-|-'
RangeBoundary() expressions
---------------------------
.. versionadded:: 3.0
.. class:: RangeBoundary(inclusive_lower=True, inclusive_upper=False)
.. attribute:: inclusive_lower
If ``True`` (default), the lower bound is inclusive ``'['``, otherwise
it's exclusive ``'('``.
.. attribute:: inclusive_upper
If ``False`` (default), the upper bound is exclusive ``')'``, otherwise
it's inclusive ``']'``.
A ``RangeBoundary()`` expression represents the range boundaries. It can be
used with a custom range functions that expected boundaries, for example to
define :class:`~django.contrib.postgres.constraints.ExclusionConstraint`. See
`the PostgreSQL documentation for the full details <https://www.postgresql.org/
docs/current/rangetypes.html#RANGETYPES-INCLUSIVITY>`_.