4
4
from django .contrib .postgres .indexes import OpClass
5
5
from django .core .checks import Error
6
6
from django .core .exceptions import ValidationError
7
- from django .db import IntegrityError , NotSupportedError , connection , transaction
7
+ from django .db import IntegrityError , connection , transaction
8
8
from django .db .models import (
9
9
CASCADE ,
10
10
CharField ,
@@ -997,7 +997,6 @@ def test_range_adjacent_gist_include(self):
997
997
RangesModel .objects .create (ints = (10 , 19 ))
998
998
RangesModel .objects .create (ints = (51 , 60 ))
999
999
1000
- @skipUnlessDBFeature ("supports_covering_spgist_indexes" )
1001
1000
def test_range_adjacent_spgist_include (self ):
1002
1001
constraint_name = "ints_adjacent_spgist_include"
1003
1002
self .assertNotIn (
@@ -1034,7 +1033,6 @@ def test_range_adjacent_gist_include_condition(self):
1034
1033
editor .add_constraint (RangesModel , constraint )
1035
1034
self .assertIn (constraint_name , self .get_constraints (RangesModel ._meta .db_table ))
1036
1035
1037
- @skipUnlessDBFeature ("supports_covering_spgist_indexes" )
1038
1036
def test_range_adjacent_spgist_include_condition (self ):
1039
1037
constraint_name = "ints_adjacent_spgist_include_condition"
1040
1038
self .assertNotIn (
@@ -1067,7 +1065,6 @@ def test_range_adjacent_gist_include_deferrable(self):
1067
1065
editor .add_constraint (RangesModel , constraint )
1068
1066
self .assertIn (constraint_name , self .get_constraints (RangesModel ._meta .db_table ))
1069
1067
1070
- @skipUnlessDBFeature ("supports_covering_spgist_indexes" )
1071
1068
def test_range_adjacent_spgist_include_deferrable (self ):
1072
1069
constraint_name = "ints_adjacent_spgist_include_deferrable"
1073
1070
self .assertNotIn (
@@ -1084,27 +1081,6 @@ def test_range_adjacent_spgist_include_deferrable(self):
1084
1081
editor .add_constraint (RangesModel , constraint )
1085
1082
self .assertIn (constraint_name , self .get_constraints (RangesModel ._meta .db_table ))
1086
1083
1087
- def test_spgist_include_not_supported (self ):
1088
- constraint_name = "ints_adjacent_spgist_include_not_supported"
1089
- constraint = ExclusionConstraint (
1090
- name = constraint_name ,
1091
- expressions = [("ints" , RangeOperators .ADJACENT_TO )],
1092
- index_type = "spgist" ,
1093
- include = ["id" ],
1094
- )
1095
- msg = (
1096
- "Covering exclusion constraints using an SP-GiST index require "
1097
- "PostgreSQL 14+."
1098
- )
1099
- with connection .schema_editor () as editor :
1100
- with mock .patch (
1101
- "django.db.backends.postgresql.features.DatabaseFeatures."
1102
- "supports_covering_spgist_indexes" ,
1103
- False ,
1104
- ):
1105
- with self .assertRaisesMessage (NotSupportedError , msg ):
1106
- editor .add_constraint (RangesModel , constraint )
1107
-
1108
1084
def test_range_adjacent_opclass (self ):
1109
1085
constraint_name = "ints_adjacent_opclass"
1110
1086
self .assertNotIn (
@@ -1187,7 +1163,6 @@ def test_range_adjacent_gist_opclass_include(self):
1187
1163
editor .add_constraint (RangesModel , constraint )
1188
1164
self .assertIn (constraint_name , self .get_constraints (RangesModel ._meta .db_table ))
1189
1165
1190
- @skipUnlessDBFeature ("supports_covering_spgist_indexes" )
1191
1166
def test_range_adjacent_spgist_opclass_include (self ):
1192
1167
constraint_name = "ints_adjacent_spgist_opclass_include"
1193
1168
self .assertNotIn (
0 commit comments