mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 10:14:19 +01:00
fix ALTER TABLE .. DROP CONSTRAINT IF NOT EXISTS
This commit is contained in:
parent
5c764a0eb8
commit
b258f91103
3 changed files with 5 additions and 1 deletions
|
@ -84,6 +84,9 @@ t2 CREATE TABLE `t2` (
|
|||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
alter table t2 drop constraint c;
|
||||
ERROR 42000: Can't DROP CONSTRAINT `c`; check that it exists
|
||||
alter table t2 drop constraint if exists c;
|
||||
Warnings:
|
||||
Note 1091 Can't DROP CONSTRAINT `c`; check that it exists
|
||||
alter table t2 drop constraint min;
|
||||
show create table t2;
|
||||
Table Create Table
|
||||
|
|
|
@ -48,6 +48,7 @@ create table t2 like t1;
|
|||
show create table t2;
|
||||
--error ER_CANT_DROP_FIELD_OR_KEY
|
||||
alter table t2 drop constraint c;
|
||||
alter table t2 drop constraint if exists c;
|
||||
alter table t2 drop constraint min;
|
||||
show create table t2;
|
||||
|
||||
|
|
|
@ -5880,7 +5880,7 @@ drop_create_field:
|
|||
}
|
||||
else if (drop->type == Alter_drop::CHECK_CONSTRAINT)
|
||||
{
|
||||
for (uint i=0; i < table->s->table_check_constraints; i++)
|
||||
for (uint i=table->s->field_check_constraints; i < table->s->table_check_constraints; i++)
|
||||
{
|
||||
if (my_strcasecmp(system_charset_info, drop->name,
|
||||
table->check_constraints[i]->name.str) == 0)
|
||||
|
|
Loading…
Add table
Reference in a new issue