From af5d6e3dc4d5f18bfe48d7f2fc387276ea6d4a50 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Mon, 14 Oct 2024 09:27:52 -0400 Subject: [PATCH] confirm support for CockroachDB 24.3 --- .github/workflows/tests.yml | 5 +++++ CHANGELOG.md | 3 ++- README.md | 2 +- django_cockroachdb/features.py | 39 +++++++++++++++++++++++++++------- 4 files changed, 39 insertions(+), 10 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 32db06e..8fdd2f4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -49,6 +49,11 @@ jobs: use_psycopg2: psycopg2 - crdb-version: v24.2.3 use_server_side_binding: server_side_binding + - crdb-version: v24.3.0 + - crdb-version: v24.3.0 + use_psycopg2: psycopg2 + - crdb-version: v24.3.0 + use_server_side_binding: server_side_binding # Uncomment to enable testing of CockroachDB nightly. #- crdb-version: LATEST #- crdb-version: LATEST diff --git a/CHANGELOG.md b/CHANGELOG.md index d28b9a7..1c16b8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,8 @@ ## 5.1.1 - Unreleased -- Confirmed support for CockroachDB 24.2.x (no code changes required). +- Confirmed support for CockroachDB 24.2.x and 24.3.x (no code changes + required). ## 5.1 - 2024-08-13 diff --git a/README.md b/README.md index a3379ea..5fb720e 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,7 @@ By default, CockroachDB sends the version of django-cockroachdb that you're using back to Cockroach Labs. To disable this, set `DISABLE_COCKROACHDB_TELEMETRY = True` in your Django settings. -## Known issues and limitations in CockroachDB 24.2.x and earlier +## Known issues and limitations in CockroachDB 24.3.x and earlier - CockroachDB [can't disable constraint checking](https://github.com/cockroachdb/cockroach/issues/19444), which means certain things in Django like forward references in fixtures diff --git a/django_cockroachdb/features.py b/django_cockroachdb/features.py index 6ebd8f9..94ac190 100644 --- a/django_cockroachdb/features.py +++ b/django_cockroachdb/features.py @@ -83,6 +83,10 @@ def is_cockroachdb_23_2(self): def is_cockroachdb_24_1(self): return self.connection.cockroachdb_version >= (24, 1) + @cached_property + def is_cockroachdb_24_3(self): + return self.connection.cockroachdb_version >= (24, 3) + @cached_property def django_test_expected_failures(self): expected_failures = super().django_test_expected_failures @@ -136,15 +140,11 @@ def django_test_expected_failures(self): 'migrations.test_operations.OperationTests.test_alter_field_pk_fk', 'migrations.test_operations.OperationTests.test_alter_field_pk_fk_char_to_int', 'migrations.test_operations.OperationTests.test_alter_field_pk_fk_db_collation', - 'migrations.test_operations.OperationTests.test_alter_field_reloads_state_on_fk_target_changes', 'migrations.test_operations.OperationTests.test_alter_field_reloads_state_fk_with_to_field_related_name_target_type_change', # noqa - 'migrations.test_operations.OperationTests.test_alter_field_reloads_state_on_fk_with_to_field_target_changes', # noqa 'migrations.test_operations.OperationTests.test_alter_field_reloads_state_on_fk_with_to_field_target_type_change', # noqa - 'migrations.test_operations.OperationTests.test_rename_field_reloads_state_on_fk_target_changes', 'schema.tests.SchemaTests.test_alter_auto_field_to_char_field', 'schema.tests.SchemaTests.test_alter_autofield_pk_to_smallautofield_pk', 'schema.tests.SchemaTests.test_alter_primary_key_db_collation', - 'schema.tests.SchemaTests.test_alter_primary_key_the_same_name', 'schema.tests.SchemaTests.test_char_field_pk_to_auto_field', 'schema.tests.SchemaTests.test_char_field_with_db_index_to_fk', 'schema.tests.SchemaTests.test_text_field_with_db_index_to_fk', @@ -182,11 +182,21 @@ def django_test_expected_failures(self): 'aggregation.tests.AggregateTestCase.test_aggregation_default_expression', # ProgrammingError: VALUES types int and float cannot be matched 'field_defaults.tests.DefaultTests.test_bulk_create_mixed_db_defaults_function', - # concat(): unknown signature: concat(string, int2) (desired ) - 'db_functions.text.test_concat.ConcatTests.test_concat_non_str', - # unknown signature: concat(varchar, int) (returning ) - 'migrations.test_operations.OperationTests.test_add_generate_field', }) + if not self.is_cockroachdb_24_3: + expected_failures.update({ + # ALTER COLUMN TYPE requiring rewrite of on-disk data is currently + # not supported for columns that are part of an index. + # https://go.crdb.dev/issue/47636 + 'schema.tests.SchemaTests.test_alter_primary_key_the_same_name', + 'migrations.test_operations.OperationTests.test_alter_field_reloads_state_on_fk_target_changes', + 'migrations.test_operations.OperationTests.test_alter_field_reloads_state_on_fk_with_to_field_target_changes', # noqa + 'migrations.test_operations.OperationTests.test_rename_field_reloads_state_on_fk_target_changes', + # unknown signature: concat(varchar, int) (returning ) + 'migrations.test_operations.OperationTests.test_add_generate_field', + # concat(): unknown signature: concat(string, int2) (desired ) + 'db_functions.text.test_concat.ConcatTests.test_concat_non_str', + }) if not self.is_cockroachdb_23_2: expected_failures.update({ # cannot index a json element: @@ -258,6 +268,10 @@ def django_test_expected_failures(self): 'queries.test_bulk_update.BulkUpdateTests.test_updated_rows_when_passing_duplicates', 'queries.test_q.QCheckTests.test_expression', 'queries.test_qs_combinators.QuerySetSetOperationTests.test_union_multiple_models_with_values_list_and_annotations', # noqa + # error in argument for $2: could not parse ":" as type int2: + # strconv.ParseInt: parsing ":": invalid syntax + # https://github.com/cockroachdb/cockroach/issues/136295 + 'db_functions.text.test_concat.ConcatTests.test_concat_non_str', # unsupported binary operator: / 'expressions.tests.FTimeDeltaTests.test_durationfield_multiply_divide', # InvalidParameterValue: unsupported binary operator: / @@ -268,6 +282,15 @@ def django_test_expected_failures(self): # operator: / (desired ) 'aggregation.tests.AggregateTestCase.test_aggregation_default_passed_another_aggregate', }) + if self.is_cockroachdb_24_3: + expected_failures.update({ + # psycopg.errors.IndeterminateDatatype: replace(): + # replace(): replace(): concat(): could not determine data + # type of placeholder $3. This worked until v24.3 added + # support for non-string data to concat(): + # https://github.com/cockroachdb/cockroach/pull/127098#issuecomment-2492652084 + "model_fields.test_uuid.TestQuerying.test_filter_with_expr", + }) else: expected_failures.update({ # Unsupported query: unsupported binary operator: / :