#30593 closed New feature (fixed)
Add support for check constraints on MariaDB 10.2+.
| Reported by: | Mariusz Felisiak | Owned by: | nobody |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | dev |
| Severity: | Normal | Keywords: | MariaDB, constraint, check |
| Cc: | Tom Forbes, Ian Foote, Adam Johnson | Triage Stage: | Accepted |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | yes |
| Easy pickings: | no | UI/UX: | no |
Description
MariaDB 10.2+ support check constraints (see check-constraints), we should support them because we officially support this database. I created PR to fix feature flags but it requires more work e.g. with introspection.
10 tests fail at 698df6a009cb1c4dbd55905264f24f6edf41066e:
constraints.tests.CheckConstraintTests.test_nameconstraints.tests.CheckConstraintTests.test_database_constraintintrospection.tests.IntrospectionTests.test_get_constraintsmigrations.test_operations.OperationTests.test_add_constraintmigrations.test_operations.OperationTests.test_add_constraint_percent_escapingmigrations.test_operations.OperationTests.test_add_or_constraintmigrations.test_operations.OperationTests.test_create_model_with_constraintmigrations.test_operations.OperationTests.test_remove_constraintschema.tests.SchemaTests.test_check_constraintsschema.tests.SchemaTests.test_remove_field_check_does_not_remove_meta_constraints
[1] https://mariadb.com/kb/en/library/information-schema-check_constraints-table/
Note:
See TracTickets
for help on using tickets.
3 tests fail:
introspection.tests.IntrospectionTests.test_get_constraintsschema.tests.SchemaTests.test_check_constraintsschema.tests.SchemaTests.test_remove_field_check_does_not_remove_meta_constraintsThe
information_schema.key_column_usagetable, does not containCHECKconstraints records. we can find them ininformation_schema.table_constraintstable.The problem is that records in
information_schema.table_constraintsdo not havecolumn_nameand we have to add them to constraints with an empty list of columns https://github.com/django/django/pull/11566/files#diff-ed5c74bb534df74e38bc62e79c84fa12R194.Those 3 tests fail because of the above-mentioned problem.
Any idea?