Skip to content

Commit

Permalink
enable DatabaseFeatures.supports_expression_indexes on CockroachDB 21.2+
Browse files Browse the repository at this point in the history
  • Loading branch information
timgraham committed Oct 26, 2021
1 parent 6c779bb commit b52a274
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions django_cockroachdb/features.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import operator

from django.db.backends.postgresql.features import (
DatabaseFeatures as PostgresDatabaseFeatures,
)
Expand Down Expand Up @@ -74,7 +76,7 @@ def introspected_field_types(self):
}

# Not supported: https://github.com/cockroachdb/cockroach/issues/9682
supports_expression_indexes = False
supports_expression_indexes = property(operator.attrgetter('is_cockroachdb_21_2'))

@cached_property
def is_cockroachdb_21_1(self):
Expand Down Expand Up @@ -184,9 +186,16 @@ def django_test_expected_failures(self):
'model_fields.test_jsonfield.TestQuerying.test_order_grouping_custom_decoder',
'model_fields.test_jsonfield.TestQuerying.test_ordering_by_transform',
'model_fields.test_jsonfield.TestQuerying.test_ordering_grouping_by_key_transform',
# unexpected partial unique index in pg_constraint query:
# cannot index a json element:
# https://github.com/cockroachdb/cockroach/issues/30690
'schema.tests.SchemaTests.test_func_index_json_key_transform',
# unexpected unique index in pg_constraint query:
# https://github.com/cockroachdb/cockroach/issues/61098
'introspection.tests.IntrospectionTests.test_get_constraints_unique_indexes_orders',
# indexing with a different collation not supported:
# https://github.com/cockroachdb/cockroach/issues/16619
'schema.tests.SchemaTests.test_func_index_collate',
'schema.tests.SchemaTests.test_func_index_collate_f_ordered',
})
if not self.connection.features.is_cockroachdb_21_2:
pass
Expand Down

0 comments on commit b52a274

Please sign in to comment.