Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ jobs:
fail-fast: false
matrix:
include:
- crdb-version: v24.1.14
- crdb-version: v24.1.14
use_psycopg2: psycopg2
- crdb-version: v24.1.14
use_server_side_binding: server_side_binding
- crdb-version: v24.3.8
- crdb-version: v24.3.8
use_psycopg2: psycopg2
Expand Down
2 changes: 1 addition & 1 deletion django-test-suite/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ VERSION=$1

# clone django into the repo.
rm -rf _django_repo
git clone --depth 1 --single-branch --branch cockroach-6.0.x https://github.com/timgraham/django _django_repo
git clone --depth 1 --single-branch --branch cockroach-6.1.x https://github.com/timgraham/django _django_repo

# install the django requirements.
cd _django_repo/tests/
Expand Down
2 changes: 1 addition & 1 deletion django_cockroachdb/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '6.0'
__version__ = '6.1a0'

# Check Django compatibility before other imports which may fail if the
# wrong version of Django is installed.
Expand Down
39 changes: 10 additions & 29 deletions django_cockroachdb/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ class DatabaseFeatures(PostgresDatabaseFeatures):
# https://github.com/cockroachdb/cockroach/issues/95068
supports_comments = False

# CockroachDB doesn't support UNIQUE NULLS NOT DISTINCT:
# https://github.com/cockroachdb/cockroach/issues/115836
supports_nulls_distinct_unique_constraints = False

@cached_property
def introspected_field_types(self):
return {
Expand Down Expand Up @@ -75,10 +79,6 @@ def introspected_field_types(self):
'virtual': None,
}

@cached_property
def is_cockroachdb_24_3(self):
return self.connection.cockroachdb_version >= (24, 3)

@cached_property
def is_cockroachdb_25_1(self):
return self.connection.cockroachdb_version >= (25, 1)
Expand Down Expand Up @@ -195,22 +195,6 @@ def django_test_expected_failures(self):
# ProgrammingError: VALUES types int and float cannot be matched
'field_defaults.tests.DefaultTests.test_bulk_create_mixed_db_defaults_function',
})
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 <string>)
'migrations.test_operations.OperationTests.test_add_generated_field',
# concat(): unknown signature: concat(string, int2) (desired <string>)
'db_functions.text.test_concat.ConcatTests.test_concat_non_str',
# unknown signature: concat(timestamptz, string)
"aggregation.tests.AggregateTestCase.test_string_agg_order_by",
})
if self.is_cockroachdb_25_1:
expected_failures.update({
# expected STORED COMPUTED COLUMN expression to have type
Expand Down Expand Up @@ -259,6 +243,12 @@ 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
# 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",
# error in argument for $2: could not parse ":" as type int2:
# strconv.ParseInt: parsing ":": invalid syntax
# https://github.com/cockroachdb/cockroach/issues/136295
Expand All @@ -275,15 +265,6 @@ def django_test_expected_failures(self):
# could not parse "@" as type timestamptz: parsing as type timestamp: empty or blank input
"aggregation.tests.AggregateTestCase.test_string_agg_order_by",
})
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",
})
if self.is_cockroachdb_25_1:
expected_failures.update({
# psycopg.errors.IndeterminateDatatype: could not determine
Expand Down
5 changes: 4 additions & 1 deletion django_cockroachdb/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ class DatabaseSchemaEditor(PostgresDatabaseSchemaEditor):

# The PostgreSQL backend uses "SET CONSTRAINTS ... IMMEDIATE" after
# creating this foreign key. This isn't supported by CockroachDB.
sql_create_column_inline_fk = 'CONSTRAINT %(name)s REFERENCES %(to_table)s(%(to_column)s)%(deferrable)s'
sql_create_column_inline_fk = (
'CONSTRAINT %(name)s REFERENCES %(to_table)s(%(to_column)s)'
'%(on_delete_db)s%(deferrable)s'
)

# The PostgreSQL backend uses "SET CONSTRAINTS ... IMMEDIATE" after this
# statement. This isn't supported by CockroachDB.
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ project_urls =
python_requires = >=3.12
packages = find:
install_requires =
django >= 6.0, < 6.1
# django >= 6.1, < 6.2

[flake8]
max-line-length = 119
Expand Down
Loading