]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
set identifier length for MySQL constraints to 64
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 30 Jan 2021 21:57:50 +0000 (16:57 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 31 Jan 2021 04:13:35 +0000 (23:13 -0500)
commit711ae40af3348ef877f0e909a13ae5e61a7440b3
treedd1082e416a883210cc8c9cd944f87b5b531d708
parent7dd3381edb15e9699d24d78caa8a1021667ce92d
set identifier length for MySQL constraints to 64

The rule to limit index names to 64 also applies to all
DDL names, such as those coming from naming conventions.
Add another limiting variable for constraint names and
create test cases against all constraint types.

Additionally, codified in the test suite MySQL's lack of
support for naming of a FOREIGN KEY constraint after
the name was given, which apparently assigns the name to an
associated KEY but not the constraint itself, until MySQL 8
and MariaDB 10.5 which appear to have resolved the
behavior.  However it's not clear how Alembic hasn't had
issues reported with this so far.

Fixed long-lived bug in MySQL dialect where the maximum identifier length
of 255 was too long for names of all types of constraints, not just
indexes, all of which have a size limit of 64. As metadata naming
conventions can create too-long names in this area, apply the limit to the
identifier generator within the DDL compiler.

Fixes: #5898
Change-Id: I79549474845dc29922275cf13321c07598dcea08
(cherry picked from commit fc1e419d139711117b0d2451d6b6e11045afeeb3)
doc/build/changelog/unreleased_13/5898.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mysql/base.py
lib/sqlalchemy/engine/default.py
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/testing/exclusions.py
lib/sqlalchemy/testing/requirements.py
lib/sqlalchemy/testing/suite/test_ddl.py
test/dialect/mysql/test_reflection.py
test/requirements.py