mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
MDEV-13508 ALTER TABLE that renames columns and CHECK constraints
Fixed by adding Item::rename_fields_processor Signed-off-by: Monty <monty@mariadb.org>
This commit is contained in:
@ -2276,5 +2276,38 @@ t1 CREATE TABLE `t1` (
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-13508 Check that rename of columns changes defaults, virtual
|
||||
# columns and constraints
|
||||
#
|
||||
create table t1 (a int, b int, check(a>b));
|
||||
alter table t1 change column a b int, change column b a int;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`b` int(11) DEFAULT NULL,
|
||||
`a` int(11) DEFAULT NULL,
|
||||
CONSTRAINT `CONSTRAINT_1` CHECK (`b` > `a`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 (a int primary key, b int, c int default (a+b) check (a+b>0),
|
||||
d int as (a+b),
|
||||
key (b),
|
||||
constraint test check (a+b > 1));
|
||||
alter table t1 change b new_b int not null, add column b char(1), add constraint new check (length(b) > 0);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL,
|
||||
`new_b` int(11) NOT NULL,
|
||||
`c` int(11) DEFAULT (`a` + `new_b`) CHECK (`a` + `new_b` > 0),
|
||||
`d` int(11) GENERATED ALWAYS AS (`a` + `new_b`) VIRTUAL,
|
||||
`b` char(1) DEFAULT NULL,
|
||||
PRIMARY KEY (`a`),
|
||||
KEY `b` (`new_b`),
|
||||
CONSTRAINT `test` CHECK (`a` + `new_b` > 1),
|
||||
CONSTRAINT `new` CHECK (length(`b`) > 0)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
#
|
||||
# End of 10.2 tests
|
||||
#
|
||||
|
Reference in New Issue
Block a user