mirror of
https://github.com/MariaDB/server.git
synced 2025-01-28 17:54:16 +01:00
bugfix: allow dropping a constraint and a column together
post-fix for 04b288ae47
This commit is contained in:
parent
429ca9a881
commit
0757a1b3e2
3 changed files with 7 additions and 7 deletions
|
@ -2228,12 +2228,11 @@ alter table t1 drop column a;
|
|||
ERROR 42S22: Unknown column 'a' in 'CHECK'
|
||||
alter table t1 drop column b, add column b bigint first;
|
||||
ERROR 42S22: Unknown column 'b' in 'CHECK'
|
||||
alter table t1 drop column a, drop constraint constraint_1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL,
|
||||
`b` int(11) DEFAULT NULL,
|
||||
CONSTRAINT `CONSTRAINT_1` CHECK (`a` > `b`)
|
||||
`b` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 (a int, b int, check(a>0));
|
||||
|
@ -2265,12 +2264,11 @@ drop table t1;
|
|||
create table t1 (a int, b int, c int, unique(a,b));
|
||||
alter table t1 drop column a;
|
||||
ERROR 42000: Key column 'a' doesn't exist in table
|
||||
alter table t1 drop column a, drop index a;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL,
|
||||
`b` int(11) DEFAULT NULL,
|
||||
`c` int(11) DEFAULT NULL,
|
||||
UNIQUE KEY `a` (`a`,`b`)
|
||||
`c` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
|
|
|
@ -1852,6 +1852,7 @@ create table t1 (a int, b int, check(a>b));
|
|||
alter table t1 drop column a;
|
||||
--error ER_BAD_FIELD_ERROR
|
||||
alter table t1 drop column b, add column b bigint first;
|
||||
alter table t1 drop column a, drop constraint constraint_1;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
|
@ -1873,5 +1874,6 @@ drop table t1;
|
|||
create table t1 (a int, b int, c int, unique(a,b));
|
||||
--error ER_KEY_COLUMN_DOES_NOT_EXITS
|
||||
alter table t1 drop column a;
|
||||
alter table t1 drop column a, drop index a;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
|
|
@ -8041,7 +8041,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
|||
}
|
||||
}
|
||||
/* see if the constraint depends on *only* on dropped fields */
|
||||
if (dropped_fields)
|
||||
if (!drop && dropped_fields)
|
||||
{
|
||||
table->default_column_bitmaps();
|
||||
bitmap_clear_all(table->read_set);
|
||||
|
|
Loading…
Add table
Reference in a new issue