1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-16102 Wrong ER_DUP_ENTRY upon ADD UNIQUE KEY on versioned table

* ignore CHECK constraint for historical rows;
* FOREIGN KEY test case.

TODO:
MDEV-16301 IB: use real table name for error messages on ALTER

Closes tempesta-tech/mariadb#491
Closes #748
This commit is contained in:
Aleksey Midenkov
2018-05-08 14:14:36 +03:00
committed by Sergei Golubchik
parent b5184c7efb
commit 7c0779da7c
7 changed files with 67 additions and 14 deletions

View File

@ -12,6 +12,10 @@ show create table t;
--error ER_VERS_ALTER_NOT_ALLOWED
alter table t add column y int;
--error ER_VERS_ALTER_NOT_ALLOWED
alter table t add primary key (a);
--error ER_VERS_ALTER_NOT_ALLOWED
alter table t add unique key (a);
--error ER_VERS_ALTER_ENGINE_PROHIBITED
alter table t engine innodb;
@ -454,5 +458,16 @@ create or replace table t1 (i int, j int as (i), s timestamp(6) as row start, e
--error ER_VERS_ALTER_SYSTEM_FIELD
alter table t1 modify s timestamp(6) as row start;
--echo # ignore CHECK for historical rows
create or replace table t (a int) with system versioning;
insert into t values (0), (1);
delete from t where a = 0;
--error ER_CONSTRAINT_FAILED
alter table t add check (a > 1);
alter table t add check (a > 0);
--error ER_CONSTRAINT_FAILED
insert into t values (0);
insert into t values (2);
drop database test;
create database test;