Details
-
Bug
-
Status: Stalled (View Workflow)
-
Major
-
Resolution: Unresolved
-
11.4.2, 10.5, 10.6, 10.11, 11.4
-
docker run --detach --publish 3306:3306 --name mariadb --env MARIADB_ROOT_PASSWORD='...' mariadb
# on M3Max Macbook Pro
Description
The following code works on RDS MariaDB version 10.11.7 and fails on MariaDB version 11.4.2-MariaDB-ubu2404 with
[HY000][1005] (conn=6) Can't create table `kasaExample`.`projection` (errno: 150 "Foreign key constraint is incorrectly formed")
|
I can create the table on 11.4.2 if I remove either:
constraint fk_projection_project foreign key ( projectId ) references project( id )
|
or
unique un_Projection_oneActivePerProject( oneActive ) ignored
|
I see no issue with either of the two definitions or their combination.
The following is a stand-alone code.
drop schema if exists kasaExample;
|
create schema if not exists kasaExample;
|
use kasaExample;
|
|
create table project(
|
id serial primary key,
|
name text not null unique ,
|
note text
|
) with system versioning;
|
|
create table projection(
|
id serial primary key,
|
projectId bigint unsigned not null , constraint fk_projection_project foreign key ( projectId ) references project( id ),
|
isActive boolean not null default false comment 'Is this the actively used projection for real world payments and expectations or just a regular test projection?',
|
name varchar( 768 ) not null ,
|
note text ,
|
oneActive bigint unsigned as ( if( isActive, projectId, null ) ) invisible,
|
unique un_Projection_oneActivePerProject( oneActive ) ignored,
|
unique un_projectionName_per_project( projectId, name )
|
) with system versioning;
|
Attachments
Issue Links
- duplicates
-
MDEV-33658 Cannot add a foreign key on a table with a long UNIQUE multi-column index, that contains a foreign key as a prefix.
- In Review
- is caused by
-
MDEV-371 Unique indexes for blobs
- Closed
- relates to
-
MDEV-32336 deb: 50-server.cnf:collation-server = utf8mb4_general_ci dated- replace with utf8mb4_uca1400_ai_ci
- Closed