Commit 5c764a0e authored by Sergei Golubchik's avatar Sergei Golubchik

clarify ER_CANT_DROP_FIELD_OR_KEY

include the dropped object type
parent 5e3a1ea1
......@@ -126,7 +126,7 @@ SELECT f1,f2,f3,f4,f5,f6,f7,f8,f9,
--disable_query_log
call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column 2 type mismatch.* 1535");
call mtr.add_suppression("Slave.*Can.t DROP .c7.; check that .* exists.* error.* 1091");
call mtr.add_suppression("Slave.*Can.t DROP COLUMN .c7.; check that .* exists.* error.* 1091");
call mtr.add_suppression("Slave.*Unknown column .c7. in .t15.* error.* 1054");
call mtr.add_suppression("Slave.*Key column .c6. doesn.t exist in table.* error.* 1072");
call mtr.add_suppression("Slave SQL.*Column 2 of table .test.t1.. cannot be converted from type.* error.* 1677");
......
......@@ -414,12 +414,12 @@ t1 CREATE TABLE `t1` (
UNIQUE KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
ALTER TABLE t1 DROP PRIMARY KEY;
ERROR 42000: Can't DROP `PRIMARY`; check that it exists
ERROR 42000: Can't DROP INDEX `PRIMARY`; check that it exists
DROP TABLE t1;
create table t1 (a int, b int, key(a));
insert into t1 values (1,1), (2,2);
alter table t1 drop key no_such_key;
ERROR 42000: Can't DROP `no_such_key`; check that it exists
ERROR 42000: Can't DROP INDEX `no_such_key`; check that it exists
alter table t1 drop key a;
drop table t1;
CREATE TABLE T12207(a int) ENGINE=MYISAM;
......@@ -1374,7 +1374,7 @@ Note 1060 Duplicate column name 'lol'
ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
Warnings:
Note 1091 Can't DROP `lol`; check that it exists
Note 1091 Can't DROP COLUMN `lol`; check that it exists
ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
Warnings:
......@@ -1385,7 +1385,7 @@ Note 1054 Unknown column 'lol' in 't1'
DROP INDEX IF EXISTS x_param ON t1;
DROP INDEX IF EXISTS x_param ON t1;
Warnings:
Note 1091 Can't DROP `x_param`; check that it exists
Note 1091 Can't DROP INDEX `x_param`; check that it exists
CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
Warnings:
......@@ -1416,7 +1416,7 @@ Note 1060 Duplicate column name 'lol'
ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
Warnings:
Note 1091 Can't DROP `lol`; check that it exists
Note 1091 Can't DROP COLUMN `lol`; check that it exists
ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
Warnings:
......@@ -1427,7 +1427,7 @@ Note 1054 Unknown column 'lol' in 't1'
DROP INDEX IF EXISTS x_param ON t1;
DROP INDEX IF EXISTS x_param ON t1;
Warnings:
Note 1091 Can't DROP `x_param`; check that it exists
Note 1091 Can't DROP INDEX `x_param`; check that it exists
CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
Warnings:
......@@ -1447,7 +1447,7 @@ Note 1061 Duplicate key name 'fk'
ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS fk;
ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS fk;
Warnings:
Note 1091 Can't DROP `fk`; check that it exists
Note 1091 Can't DROP FOREIGN KEY `fk`; check that it exists
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
......@@ -1461,7 +1461,7 @@ Note 1061 Duplicate key name 't2_ibfk_1'
ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS t2_ibfk_1;
ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS t2_ibfk_1;
Warnings:
Note 1091 Can't DROP `t2_ibfk_1`; check that it exists
Note 1091 Can't DROP FOREIGN KEY `t2_ibfk_1`; check that it exists
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
......@@ -1486,10 +1486,10 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
ALTER TABLE t2 DROP KEY k_id, DROP KEY IF EXISTS k_id;
Warnings:
Note 1091 Can't DROP `k_id`; check that it exists
Note 1091 Can't DROP INDEX `k_id`; check that it exists
ALTER TABLE t2 DROP COLUMN a, DROP COLUMN IF EXISTS a;
Warnings:
Note 1091 Can't DROP `a`; check that it exists
Note 1091 Can't DROP COLUMN `a`; check that it exists
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
......
......@@ -83,7 +83,7 @@ t2 CREATE TABLE `t2` (
CONSTRAINT `CONSTRAINT_1` CHECK (a+b+c < 500)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t2 drop constraint c;
ERROR 42000: Can't DROP `c`; check that it exists
ERROR 42000: Can't DROP CONSTRAINT `c`; check that it exists
alter table t2 drop constraint min;
show create table t2;
Table Create Table
......
......@@ -363,7 +363,7 @@ t1 CREATE TABLE `t1` (
DROP INDEX IF EXISTS i1 ON t1;
DROP INDEX IF EXISTS i1 ON t1;
Warnings:
Note 1091 Can't DROP `i1`; check that it exists
Note 1091 Can't DROP INDEX `i1`; check that it exists
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
Warnings:
......
......@@ -16,7 +16,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP INDEX IF EXISTS i1 ON t1;
Warnings:
Note 1091 Can't DROP `i1`; check that it exists
Note 1091 Can't DROP INDEX `i1`; check that it exists
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
......
......@@ -467,7 +467,7 @@ alter table t1 drop index c2, add index (c2(4),c3(7));
alter table t1 add primary key (c1, c2), drop primary key;
alter table t1 drop primary key;
alter table t1 add primary key (c1, c2), drop primary key;
ERROR 42000: Can't DROP `PRIMARY`; check that it exists
ERROR 42000: Can't DROP INDEX `PRIMARY`; check that it exists
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
......
DROP TABLE IF EXISTS t9;
CREATE TABLE t9(c1 INTEGER NOT NULL);
DROP INDEX i1 ON t9;
ERROR 42000: Can't DROP `i1`; check that it exists
ERROR 42000: Can't DROP INDEX `i1`; check that it exists
DROP TABLE t9;
SHOW TABLES;
Tables_in_test
......@@ -544,9 +544,9 @@ t2 CREATE TABLE `t2` (
delete from t1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `dc` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
drop index dc on t4;
ERROR 42000: Can't DROP `dc`; check that it exists
ERROR 42000: Can't DROP INDEX `dc`; check that it exists
alter table t3 drop foreign key dc;
ERROR 42000: Can't DROP `dc`; check that it exists
ERROR 42000: Can't DROP FOREIGN KEY `dc`; check that it exists
alter table t4 drop foreign key dc;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
......
......@@ -636,7 +636,7 @@ c1 c3 hex(c4) c5 c6
************
connection slave;
include/wait_for_slave_sql_error.inc [errno=1091]
Last_SQL_Error = 'Error 'Can't DROP `c7`; check that it exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7''
Last_SQL_Error = 'Error 'Can't DROP COLUMN `c7`; check that it exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7''
STOP SLAVE;
RESET SLAVE;
......
......@@ -636,7 +636,7 @@ c1 c3 hex(c4) c5 c6
************
connection slave;
include/wait_for_slave_sql_error.inc [errno=1091]
Last_SQL_Error = 'Error 'Can't DROP `c7`; check that it exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7''
Last_SQL_Error = 'Error 'Can't DROP COLUMN `c7`; check that it exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7''
STOP SLAVE;
RESET SLAVE;
......
......@@ -2071,29 +2071,27 @@ ER_CANT_REMOVE_ALL_FIELDS 42000
swe "Man kan inte radera alla fält med ALTER TABLE. Använd DROP TABLE istället"
ukr "Не можливо видалити всі стовбці за допомогою ALTER TABLE. Для цього скористайтеся DROP TABLE"
ER_CANT_DROP_FIELD_OR_KEY 42000
cze "Nemohu zrušit %`-.192s (provést DROP). Zkontrolujte, zda neexistují záznamy/klíče"
dan "Kan ikke udføre DROP %`-.192s. Undersøg om feltet/nøglen eksisterer."
nla "Kan %`-.192s niet weggooien. Controleer of het veld of de zoeksleutel daadwerkelijk bestaat."
eng "Can't DROP %`-.192s; check that it exists"
est "Ei suuda kustutada %`-.192s. Kontrolli kas tulp/võti eksisteerib"
fre "Ne peut effacer (DROP) %`-.192s. Vérifiez s'il existe"
ger "Kann %`-.192s nicht löschen. Existiert es?"
greek "Αδύνατη η διαγραφή (DROP) %`-.192s. Παρακαλώ ελέγξτε αν το πεδίο/κλειδί υπάρχει"
hun "A DROP %`-.192s nem lehetseges. Ellenorizze, hogy a mezo/kulcs letezik-e"
ita "Impossibile cancellare %`-.192s. Controllare che il campo chiave esista"
jpn "%`-.192s を削除できません。列/索引の存在を確認して下さい。"
kor "%`-.192s를 DROP할 수 없습니다. 칼럼이나 키가 존재하는지 채크하세요."
nor "Kan ikke DROP %`-.192s. Undersøk om felt/nøkkel eksisterer."
norwegian-ny "Kan ikkje DROP %`-.192s. Undersøk om felt/nøkkel eksisterar."
pol "Nie można wykonać operacji DROP %`-.192s. SprawdĽ, czy to pole/klucz istnieje"
por "Não se pode fazer DROP %`-.192s. Confira se esta coluna/chave existe"
rum "Nu pot sa DROP %`-.192s. Verifica daca coloana/cheia exista"
rus "Невозможно удалить (DROP) %`-.192s. Убедитесь что он действительно существует"
serbian "Ne mogu da izvršim komandu drop 'DROP' na %`-.192s. Proverite da li ta kolona (odnosno ključ) postoji"
slo "Nemôžem zrušiť (DROP) %`-.192s. Skontrolujte, či neexistujú záznamy/kľúče"
spa "No puedo ELIMINAR %`-.192s. compuebe que el campo/clave existe"
swe "Kan inte ta bort %`-.192s. Kontrollera att begränsningen/fältet/nyckel finns"
ukr "Не можу DROP %`-.192s. Перевірте, чи він існує"
cze "Nemohu zrušit (DROP %s) %`-.192s. Zkontrolujte, zda neexistují záznamy/klíče"
dan "Kan ikke udføre DROP %s %`-.192s. Undersøg om feltet/nøglen eksisterer."
nla "DROP %s: Kan %`-.192s niet weggooien. Controleer of het veld of de zoeksleutel daadwerkelijk bestaat."
eng "Can't DROP %s %`-.192s; check that it exists"
est "Ei suuda kustutada (DROP %s) %`-.192s. Kontrolli kas tulp/võti eksisteerib"
fre "Ne peut effacer (DROP %s) %`-.192s. Vérifiez s'il existe"
ger "DROP %s: Kann %`-.192s nicht löschen. Existiert es?"
greek "Αδύνατη η διαγραφή (DROP %s) %`-.192s. Παρακαλώ ελέγξτε αν το πεδίο/κλειδί υπάρχει"
hun "A DROP %s %`-.192s nem lehetseges. Ellenorizze, hogy a mezo/kulcs letezik-e"
ita "Impossibile cancellare (DROP %s) %`-.192s. Controllare che il campo chiave esista"
nor "Kan ikke DROP %s %`-.192s. Undersøk om felt/nøkkel eksisterer."
norwegian-ny "Kan ikkje DROP %s %`-.192s. Undersøk om felt/nøkkel eksisterar."
pol "Nie można wykonać operacji DROP %s %`-.192s. SprawdĽ, czy to pole/klucz istnieje"
por "Não se pode fazer DROP %s %`-.192s. Confira se esta coluna/chave existe"
rum "Nu pot sa DROP %s %`-.192s. Verifica daca coloana/cheia exista"
rus "Невозможно удалить (DROP %s) %`-.192s. Убедитесь что он действительно существует"
serbian "Ne mogu da izvršim komandu drop 'DROP %s' na %`-.192s. Proverite da li ta kolona (odnosno ključ) postoji"
slo "Nemôžem zrušiť (DROP %s) %`-.192s. Skontrolujte, či neexistujú záznamy/kľúče"
spa "No puedo eliminar (DROP %s) %`-.192s. compuebe que el campo/clave existe"
swe "Kan inte ta bort (DROP %s) %`-.192s. Kontrollera att begränsningen/fältet/nyckel finns"
ukr "Не можу DROP %s %`-.192s. Перевірте, чи він існує"
ER_INSERT_INFO
cze "Záznamů: %ld Zdvojených: %ld Varování: %ld"
dan "Poster: %ld Ens: %ld Advarsler: %ld"
......
......@@ -272,6 +272,12 @@ class Alter_drop :public Sql_alloc {
*/
Alter_drop *clone(MEM_ROOT *mem_root) const
{ return new (mem_root) Alter_drop(*this); }
const char *type_name()
{
return type == COLUMN ? "COLUMN" :
type == CHECK_CONSTRAINT ? "CONSTRAINT" :
type == KEY ? "INDEX" : "FOREIGN KEY";
}
};
......
......@@ -5947,7 +5947,7 @@ handle_if_exists_options(THD *thd, TABLE *table, Alter_info *alter_info)
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_CANT_DROP_FIELD_OR_KEY,
ER_THD(thd, ER_CANT_DROP_FIELD_OR_KEY),
drop->name);
drop->type_name(), drop->name);
drop_it.remove();
if (alter_info->drop_list.is_empty())
alter_info->flags&= ~(Alter_info::ALTER_DROP_COLUMN |
......@@ -7890,7 +7890,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
case Alter_drop::KEY:
case Alter_drop::COLUMN:
case Alter_drop::CHECK_CONSTRAINT:
my_error(ER_CANT_DROP_FIELD_OR_KEY, MYF(0),
my_error(ER_CANT_DROP_FIELD_OR_KEY, MYF(0), drop->type_name(),
alter_info->drop_list.head()->name);
goto err;
case Alter_drop::FOREIGN_KEY:
......@@ -7899,12 +7899,6 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
}
}
}
if (alter_info->alter_list.elements)
{
my_error(ER_CANT_DROP_FIELD_OR_KEY, MYF(0),
alter_info->alter_list.head()->name);
goto err;
}
if (!create_info->comment.str)
{
......
......@@ -19,7 +19,7 @@ SELECT * FROM t1 WHERE i = 5;
i
5
ALTER TABLE t1 DROP INDEX i;
ERROR 42000: Can't DROP `i`; check that it exists
ERROR 42000: Can't DROP INDEX `i`; check that it exists
DROP INDEX i ON t1;
ERROR 42000: Can't DROP `i`; check that it exists
ERROR 42000: Can't DROP INDEX `i`; check that it exists
DROP TABLE t1;
......@@ -3789,7 +3789,7 @@ ha_innobase::prepare_inplace_alter_table(
}
my_error(ER_CANT_DROP_FIELD_OR_KEY, MYF(0),
drop->name);
drop->type_name(), drop->name);
goto err_exit;
found_fk:
continue;
......
......@@ -636,7 +636,7 @@ c1 c3 hex(c4) c5 c6
************
connection slave;
include/wait_for_slave_sql_error.inc [errno=1091]
Last_SQL_Error = 'Error 'Can't DROP `c7`; check that it exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7''
Last_SQL_Error = 'Error 'Can't DROP COLUMN `c7`; check that it exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7''
STOP SLAVE;
RESET SLAVE;
......
......@@ -3803,7 +3803,7 @@ ha_innobase::prepare_inplace_alter_table(
}
my_error(ER_CANT_DROP_FIELD_OR_KEY, MYF(0),
drop->name);
drop->type_name(), drop->name);
goto err_exit;
found_fk:
continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment