← Back
Editing: constraints.cpython-311.pyc
� �|�e� � �p � d dl mZ d dlmZmZ d dlmZmZmZ d dl m Z d dlmZ dgZ G d� de � � ZdS ) � )�NotSupportedError)� Statement�Table)� Deferrable�F�Q)�BaseConstraint)�Query�ExclusionConstraintc �n � � e Zd ZdZdddddd�� fd� Zd� Zd� Zd� Zd � Zd � Z d� Z � fd�Z� fd �Zd� Z � xZS )r zdCONSTRAINT %(name)s EXCLUDE USING %(index_type)s (%(expressions)s)%(include)s%(where)s%(deferrable)sN� )� index_type� condition� deferrable�include� opclassesc � �� |r%|� � � dvrt d� � �|st d� � �t d� |D � � � � st d� � �t |t d � � t f� � st d� � �|r|rt d� � �t |t d � � t f� � st d� � �t |t d � � t t f� � st d � � �|r)|r'|� � � d k rt d� � �t |t t f� � st d� � �|r/t |� � t |� � k rt d � � �|| _ |pd| _ || _ || _ |rt |� � nd| _ || _ t! � � � |�� � d S )N> �gist�spgistz;Exclusion constraints only support GiST or SP-GiST indexes.zFAt least one expression is required to define an exclusion constraint.c 3 �t K � | ]3}t |t t f� � ot |� � d k V � �4dS )� N)� isinstance�list�tuple�len)�.0�exprs �E/usr/lib/python3/dist-packages/django/contrib/postgres/constraints.py� <genexpr>z/ExclusionConstraint.__init__.<locals>.<genexpr> sS � � � � � �� �t�d�E�]�+�+�>��D� � �Q�� � � � � � � z+The expressions must be a list of 2-tuples.z3ExclusionConstraint.condition must be a Q instance.z7ExclusionConstraint with conditions cannot be deferred.z=ExclusionConstraint.deferrable must be a Deferrable instance.z4ExclusionConstraint.include must be a list or tuple.r z9Covering exclusion constraints only support GiST indexes.z6ExclusionConstraint.opclasses must be a list or tuple.zhExclusionConstraint.expressions and ExclusionConstraint.opclasses must have the same number of elements.�GISTr )�name)�lower� ValueError�allr �typer r r r r �expressionsr r r r r �super�__init__) �selfr"