mirror of
https://github.com/django/django.git
synced 2025-08-06 03:48:38 +00:00
Refs #32943 -- Added support for covering exclusion constraints using SP-GiST indexes on PostgreSQL 14+.
This commit is contained in:
parent
e76f9d5b44
commit
c2f6c05c4c
4 changed files with 131 additions and 29 deletions
|
@ -45,10 +45,6 @@ class ExclusionConstraint(BaseConstraint):
|
|||
raise ValueError(
|
||||
'ExclusionConstraint.include must be a list or tuple.'
|
||||
)
|
||||
if include and index_type and index_type.lower() != 'gist':
|
||||
raise ValueError(
|
||||
'Covering exclusion constraints only support GiST indexes.'
|
||||
)
|
||||
if not isinstance(opclasses, (list, tuple)):
|
||||
raise ValueError(
|
||||
'ExclusionConstraint.opclasses must be a list or tuple.'
|
||||
|
@ -124,9 +120,23 @@ class ExclusionConstraint(BaseConstraint):
|
|||
)
|
||||
|
||||
def check_supported(self, schema_editor):
|
||||
if self.include and not schema_editor.connection.features.supports_covering_gist_indexes:
|
||||
if (
|
||||
self.include and
|
||||
self.index_type.lower() == 'gist' and
|
||||
not schema_editor.connection.features.supports_covering_gist_indexes
|
||||
):
|
||||
raise NotSupportedError(
|
||||
'Covering exclusion constraints require PostgreSQL 12+.'
|
||||
'Covering exclusion constraints using a GiST index require '
|
||||
'PostgreSQL 12+.'
|
||||
)
|
||||
if (
|
||||
self.include and
|
||||
self.index_type.lower() == 'spgist' and
|
||||
not schema_editor.connection.features.supports_covering_spgist_indexes
|
||||
):
|
||||
raise NotSupportedError(
|
||||
'Covering exclusion constraints using an SP-GiST index '
|
||||
'require PostgreSQL 14+.'
|
||||
)
|
||||
|
||||
def deconstruct(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue