Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.2(EOL)
Description
create or replace table a (
|
cola int(10) primary key,
|
v_cola int(10) as (cola mod 10) virtual,
|
p_cola int(10) as (cola mod 10) persistent
|
);
|
|
create index v_cola on a (v_cola);
|
create index p_cola on a (p_cola);
|
|
create or replace table b(
|
cola int(10),
|
v_cola int(10),
|
p_cola int(10)
|
);
|
|
alter table b add constraint `p_cola_fk`
|
foreign key (p_cola) references a (p_cola)
|
on delete restrict
|
on update restrict;
|
|
alter table b add constraint `v_cola_fk`
|
foreign key (v_cola) references a (v_cola)
|
on delete restrict
|
on update restrict;
|
ERROR 1005 (HY000): Can't create table `test`.`#sql-181_8` (errno: 150 "Foreign key constraint is incorrectly formed")
|
MariaDB [test]> show warnings;
|
+---------+------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
| Level | Code | Message |
|
+---------+------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
| Warning | 150 | Alter table `test`.`b` with foreign key constraint failed. Parse error in '
|
foreign key (v_cola) references a (v_cola)
|
on delete restrict
|
on update restrict' near 'v_cola)
|
on delete restrict
|
on update restrict'. |
|
| Error | 1005 | Can't create table `test`.`#sql-181_8` (errno: 150 "Foreign key constraint is incorrectly formed") |
|
| Warning | 1215 | Cannot add foreign key constraint |
|
+---------+------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
3 rows in set (0.00 sec)
|
|
Attachments
Activity
Field | Original Value | New Value |
---|---|---|
Status | Open [ 1 ] | In Progress [ 3 ] |
Assignee | Jan Lindström [ jplindst ] | Marko Mäkelä [ marko ] |
Status | In Progress [ 3 ] | In Review [ 10002 ] |
Description |
{noformat}
create or replace table a ( cola int(10) primary key, v_cola int(10) as (cola mod 10) virtual, p_cola int(10) as (cola mod 10) persistent ); create index v_cola on a (v_cola); create index p_cola on a (p_cola); create or replace table b( cola int(10), v_cola int(10), p_cola int(10) ); alter table b add constraint `p_cola_fk` foreign key (p_cola) references a (p_cola) on delete restrict on update restrict; alter table b add constraint `v_cola_fk` foreign key (v_cola) references a (v_cola) on delete restrict on update restrict; {noformat} |
{noformat}
create or replace table a ( cola int(10) primary key, v_cola int(10) as (cola mod 10) virtual, p_cola int(10) as (cola mod 10) persistent ); create index v_cola on a (v_cola); create index p_cola on a (p_cola); create or replace table b( cola int(10), v_cola int(10), p_cola int(10) ); alter table b add constraint `p_cola_fk` foreign key (p_cola) references a (p_cola) on delete restrict on update restrict; alter table b add constraint `v_cola_fk` foreign key (v_cola) references a (v_cola) on delete restrict on update restrict; {noformat} {code} ERROR 1005 (HY000): Can't create table `test`.`#sql-181_8` (errno: 150 "Foreign key constraint is incorrectly formed") MariaDB [test]> show warnings; +---------+------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Level | Code | Message | +---------+------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Warning | 150 | Alter table `test`.`b` with foreign key constraint failed. Parse error in ' foreign key (v_cola) references a (v_cola) on delete restrict on update restrict' near 'v_cola) on delete restrict on update restrict'. | | Error | 1005 | Can't create table `test`.`#sql-181_8` (errno: 150 "Foreign key constraint is incorrectly formed") | | Warning | 1215 | Cannot add foreign key constraint | +---------+------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 3 rows in set (0.00 sec) {code} |
Labels | 10.2-rc |
Fix Version/s | 10.2.4 [ 22116 ] | |
Fix Version/s | 10.2 [ 14601 ] |
Assignee | Marko Mäkelä [ marko ] | Jan Lindström [ jplindst ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
Status | Stalled [ 10000 ] | In Progress [ 3 ] |
Resolution | Fixed [ 1 ] | |
Status | In Progress [ 3 ] | Closed [ 6 ] |
Workflow | MariaDB v3 [ 79290 ] | MariaDB v4 [ 151566 ] |
http://lists.askmonty.org/pipermail/commits/2017-January/010471.html