MDEV-12923 MyISAM allows CHECK constraint violation in ALTER TABLE
use correct type for Alter_inplace_info flags.
This commit is contained in:
parent
9edfc00697
commit
7bea860709
@ -1925,8 +1925,8 @@ ALTER TABLE ti1 FORCE;
|
|||||||
affected rows: 0
|
affected rows: 0
|
||||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||||
ALTER TABLE tm1 FORCE;
|
ALTER TABLE tm1 FORCE;
|
||||||
affected rows: 0
|
affected rows: 2
|
||||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
info: Records: 2 Duplicates: 0 Warnings: 0
|
||||||
ALTER TABLE ti1 AUTO_INCREMENT 3;
|
ALTER TABLE ti1 AUTO_INCREMENT 3;
|
||||||
affected rows: 0
|
affected rows: 0
|
||||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||||
|
@ -83,6 +83,8 @@ partition p2 values less than ('2020-10-19'));
|
|||||||
insert t1 values (0, '2000-01-02', 0);
|
insert t1 values (0, '2000-01-02', 0);
|
||||||
insert t1 values (1, '2020-01-02', 10);
|
insert t1 values (1, '2020-01-02', 10);
|
||||||
alter table t1 add check (b in (0, 1));
|
alter table t1 add check (b in (0, 1));
|
||||||
|
ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`#sql-temporary`
|
||||||
|
alter table t1 add check (b in (0, 10));
|
||||||
show create table t1;
|
show create table t1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
t1 CREATE TABLE `t1` (
|
t1 CREATE TABLE `t1` (
|
||||||
@ -90,7 +92,7 @@ t1 CREATE TABLE `t1` (
|
|||||||
`d` date NOT NULL,
|
`d` date NOT NULL,
|
||||||
`b` tinyint(1) NOT NULL DEFAULT 0,
|
`b` tinyint(1) NOT NULL DEFAULT 0,
|
||||||
PRIMARY KEY (`id`,`d`),
|
PRIMARY KEY (`id`,`d`),
|
||||||
CONSTRAINT `CONSTRAINT_1` CHECK (`b` in (0,1))
|
CONSTRAINT `CONSTRAINT_1` CHECK (`b` in (0,10))
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
PARTITION BY RANGE COLUMNS(d)
|
PARTITION BY RANGE COLUMNS(d)
|
||||||
(PARTITION p1 VALUES LESS THAN ('2016-10-18') ENGINE = MyISAM,
|
(PARTITION p1 VALUES LESS THAN ('2016-10-18') ENGINE = MyISAM,
|
||||||
|
@ -96,8 +96,10 @@ partition p1 values less than ('2016-10-18'),
|
|||||||
partition p2 values less than ('2020-10-19'));
|
partition p2 values less than ('2020-10-19'));
|
||||||
insert t1 values (0, '2000-01-02', 0);
|
insert t1 values (0, '2000-01-02', 0);
|
||||||
insert t1 values (1, '2020-01-02', 10);
|
insert t1 values (1, '2020-01-02', 10);
|
||||||
# FIXME: MDEV-12923 MyISAM allows CHECK constraint violation in ALTER TABLE
|
--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
|
||||||
|
--error ER_CONSTRAINT_FAILED
|
||||||
alter table t1 add check (b in (0, 1));
|
alter table t1 add check (b in (0, 1));
|
||||||
|
alter table t1 add check (b in (0, 10));
|
||||||
show create table t1;
|
show create table t1;
|
||||||
--error ER_CONSTRAINT_FAILED
|
--error ER_CONSTRAINT_FAILED
|
||||||
insert t1 values (2, '2020-01-03', 20);
|
insert t1 values (2, '2020-01-03', 20);
|
||||||
|
@ -2291,16 +2291,19 @@ ha_myisam::check_if_supported_inplace_alter(TABLE *new_table,
|
|||||||
{
|
{
|
||||||
DBUG_ENTER("ha_myisam::check_if_supported_inplace_alter");
|
DBUG_ENTER("ha_myisam::check_if_supported_inplace_alter");
|
||||||
|
|
||||||
const uint readd_index= Alter_inplace_info::ADD_INDEX |
|
const Alter_inplace_info::HA_ALTER_FLAGS readd_index=
|
||||||
|
Alter_inplace_info::ADD_INDEX |
|
||||||
Alter_inplace_info::DROP_INDEX;
|
Alter_inplace_info::DROP_INDEX;
|
||||||
const uint readd_unique= Alter_inplace_info::ADD_UNIQUE_INDEX |
|
const Alter_inplace_info::HA_ALTER_FLAGS readd_unique=
|
||||||
Alter_inplace_info::DROP_UNIQUE_INDEX;
|
Alter_inplace_info::ADD_UNIQUE_INDEX |
|
||||||
const uint readd_pk= Alter_inplace_info::ADD_PK_INDEX |
|
Alter_inplace_info::DROP_UNIQUE_INDEX;
|
||||||
Alter_inplace_info::DROP_PK_INDEX;
|
const Alter_inplace_info::HA_ALTER_FLAGS readd_pk=
|
||||||
|
Alter_inplace_info::ADD_PK_INDEX |
|
||||||
|
Alter_inplace_info::DROP_PK_INDEX;
|
||||||
|
|
||||||
const uint op= alter_info->handler_flags;
|
const Alter_inplace_info::HA_ALTER_FLAGS op= alter_info->handler_flags;
|
||||||
|
|
||||||
if (alter_info->handler_flags & Alter_inplace_info::ALTER_COLUMN_VCOL)
|
if (op & Alter_inplace_info::ALTER_COLUMN_VCOL)
|
||||||
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
|
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user