summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql
diff options
context:
space:
mode:
authorFederico Caselli <cfederico87@gmail.com>2023-02-27 22:47:19 +0100
committerFederico Caselli <cfederico87@gmail.com>2023-02-27 22:47:19 +0100
commita7f3dad6c93ab43a11521a2ecd240b5e023367fc (patch)
treed72c4dc6f97601e627b14fe5a47446df0f144536 /lib/sqlalchemy/dialects/postgresql
parentfcab6bcc5a5a414c9775120f15c7dbd52ccf4ae3 (diff)
downloadsqlalchemy-a7f3dad6c93ab43a11521a2ecd240b5e023367fc.tar.gz
Improve exclude constraint docs and tests.
Follow up of 71693c94d52612a5e88128575ff308ee4a923c00 Change-Id: Icc9d9942bda92171581dec82cf0cacbd3e3e4162
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/ext.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/ext.py b/lib/sqlalchemy/dialects/postgresql/ext.py
index 22604955d..f382af86f 100644
--- a/lib/sqlalchemy/dialects/postgresql/ext.py
+++ b/lib/sqlalchemy/dialects/postgresql/ext.py
@@ -164,15 +164,19 @@ class ExcludeConstraint(ColumnCollectionConstraint):
:param \*elements:
A sequence of two tuples of the form ``(column, operator)`` where
- "column" is a SQL expression element or the name of a column as
- string, most typically a :class:`_schema.Column` object,
- and "operator" is a string containing the operator to use.
+ "column" is either a :class:`_schema.Column` object, or a SQL
+ expression element (e.g. ``func.int8range(table.from, table.to)``)
+ or the name of a column as string, and "operator" is a string
+ containing the operator to use (e.g. `"&&"` or `"="`).
+
In order to specify a column name when a :class:`_schema.Column`
object is not available, while ensuring
that any necessary quoting rules take effect, an ad-hoc
:class:`_schema.Column` or :func:`_expression.column`
- object should be used. ``column`` may also be a string SQL
- expression when passed as :func:`_expression.literal_column`
+ object should be used.
+ The ``column`` may also be a string SQL expression when
+ passed as :func:`_expression.literal_column` or
+ :func:`_expression.text`
:param name:
Optional, the in-database name of this constraint.