mirror of
https://github.com/MariaDB/server.git
synced 2025-11-12 10:22:39 +03:00
Updated error message for wrong foreign key constraint
This commit is contained in:
@@ -27,7 +27,7 @@ show warnings;
|
|||||||
Level Code Message
|
Level Code Message
|
||||||
Warning 150 Create table '`test`.`t2`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns near ' foreign key a (a) references t1(a)) engine=innodb'.
|
Warning 150 Create table '`test`.`t2`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns near ' foreign key a (a) references t1(a)) engine=innodb'.
|
||||||
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
||||||
Warning 1215 Cannot add foreign key constraint
|
Warning 1215 Cannot add foreign key constraint for `t2`
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1(a int not null primary key, b int) engine=innodb;
|
create table t1(a int not null primary key, b int) engine=innodb;
|
||||||
create table t2(a int, b int, constraint a foreign key a (a) references t1(a),
|
create table t2(a int, b int, constraint a foreign key a (a) references t1(a),
|
||||||
@@ -36,7 +36,7 @@ ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint
|
|||||||
show warnings;
|
show warnings;
|
||||||
Level Code Message
|
Level Code Message
|
||||||
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
||||||
Warning 1215 Cannot add foreign key constraint
|
Warning 1215 Cannot add foreign key constraint for `t2`
|
||||||
create table t2(a int, b int, constraint a foreign key a (a) references t1(a)) engine=innodb;
|
create table t2(a int, b int, constraint a foreign key a (a) references t1(a)) engine=innodb;
|
||||||
alter table t2 add constraint b foreign key (b) references t2(b);
|
alter table t2 add constraint b foreign key (b) references t2(b);
|
||||||
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
|
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
|
||||||
@@ -44,7 +44,7 @@ show warnings;
|
|||||||
Level Code Message
|
Level Code Message
|
||||||
Warning 150 Alter table '`test`.`t2`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns near ' foreign key (b) references t2(b)'.
|
Warning 150 Alter table '`test`.`t2`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns near ' foreign key (b) references t2(b)'.
|
||||||
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
|
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
|
||||||
Warning 1215 Cannot add foreign key constraint
|
Warning 1215 Cannot add foreign key constraint for `#sql-temporary`
|
||||||
drop table t2, t1;
|
drop table t2, t1;
|
||||||
create table t1 (f1 integer primary key) engine=innodb;
|
create table t1 (f1 integer primary key) engine=innodb;
|
||||||
alter table t1 add constraint c1 foreign key (f1) references t11(f1);
|
alter table t1 add constraint c1 foreign key (f1) references t11(f1);
|
||||||
@@ -53,7 +53,7 @@ show warnings;
|
|||||||
Level Code Message
|
Level Code Message
|
||||||
Warning 150 Alter table `test`.`t1` with foreign key constraint failed. Referenced table `test`.`t11` not found in the data dictionary near ' foreign key (f1) references t11(f1)'.
|
Warning 150 Alter table `test`.`t1` with foreign key constraint failed. Referenced table `test`.`t11` not found in the data dictionary near ' foreign key (f1) references t11(f1)'.
|
||||||
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
|
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
|
||||||
Warning 1215 Cannot add foreign key constraint
|
Warning 1215 Cannot add foreign key constraint for `#sql-temporary`
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create temporary table t1(a int not null primary key, b int, key(b)) engine=innodb;
|
create temporary table t1(a int not null primary key, b int, key(b)) engine=innodb;
|
||||||
create temporary table t2(a int, foreign key(a) references t1(a)) engine=innodb;
|
create temporary table t2(a int, foreign key(a) references t1(a)) engine=innodb;
|
||||||
@@ -76,14 +76,14 @@ show warnings;
|
|||||||
Level Code Message
|
Level Code Message
|
||||||
Warning 150 Create table `mysqld.1`.`t2` with foreign key constraint failed. Referenced table `mysqld.1`.`t1` not found in the data dictionary near 'foreign key(a) references t1(a)) engine=innodb'.
|
Warning 150 Create table `mysqld.1`.`t2` with foreign key constraint failed. Referenced table `mysqld.1`.`t1` not found in the data dictionary near 'foreign key(a) references t1(a)) engine=innodb'.
|
||||||
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
||||||
Warning 1215 Cannot add foreign key constraint
|
Warning 1215 Cannot add foreign key constraint for `t2`
|
||||||
alter table t1 add foreign key(b) references t1(a);
|
alter table t1 add foreign key(b) references t1(a);
|
||||||
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
|
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
|
||||||
show warnings;
|
show warnings;
|
||||||
Level Code Message
|
Level Code Message
|
||||||
Warning 150 Alter table `mysqld.1`.`t1` with foreign key constraint failed. Referenced table `mysqld.1`.`t1` not found in the data dictionary near 'foreign key(b) references t1(a)'.
|
Warning 150 Alter table `mysqld.1`.`t1` with foreign key constraint failed. Referenced table `mysqld.1`.`t1` not found in the data dictionary near 'foreign key(b) references t1(a)'.
|
||||||
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
|
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
|
||||||
Warning 1215 Cannot add foreign key constraint
|
Warning 1215 Cannot add foreign key constraint for `#sql-temporary`
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1(a int not null primary key, b int, key(b)) engine=innodb;
|
create table t1(a int not null primary key, b int, key(b)) engine=innodb;
|
||||||
alter table t1 add foreign key(a,b) references t1(a);
|
alter table t1 add foreign key(a,b) references t1(a);
|
||||||
@@ -106,14 +106,14 @@ show warnings;
|
|||||||
Level Code Message
|
Level Code Message
|
||||||
Warning 150 Alter table `test`.`t1` with foreign key constraint failed. You have defined a SET NULL condition but column 'f1' is defined as NOT NULL in ' foreign key (f1) references t1(f1) on update set null' near ' on update set null'.
|
Warning 150 Alter table `test`.`t1` with foreign key constraint failed. You have defined a SET NULL condition but column 'f1' is defined as NOT NULL in ' foreign key (f1) references t1(f1) on update set null' near ' on update set null'.
|
||||||
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
|
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
|
||||||
Warning 1215 Cannot add foreign key constraint
|
Warning 1215 Cannot add foreign key constraint for `#sql-temporary`
|
||||||
create table t2(a int not null, foreign key(a) references t1(f1) on delete set null) engine=innodb;
|
create table t2(a int not null, foreign key(a) references t1(f1) on delete set null) engine=innodb;
|
||||||
ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
||||||
show warnings;
|
show warnings;
|
||||||
Level Code Message
|
Level Code Message
|
||||||
Warning 150 Create table `test`.`t2` with foreign key constraint failed. You have defined a SET NULL condition but column 'a' is defined as NOT NULL in 'foreign key(a) references t1(f1) on delete set null) engine=innodb' near ' on delete set null) engine=innodb'.
|
Warning 150 Create table `test`.`t2` with foreign key constraint failed. You have defined a SET NULL condition but column 'a' is defined as NOT NULL in 'foreign key(a) references t1(f1) on delete set null) engine=innodb' near ' on delete set null) engine=innodb'.
|
||||||
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
||||||
Warning 1215 Cannot add foreign key constraint
|
Warning 1215 Cannot add foreign key constraint for `t2`
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (id int not null primary key, f1 int, f2 int, key(f1)) engine=innodb;
|
create table t1 (id int not null primary key, f1 int, f2 int, key(f1)) engine=innodb;
|
||||||
create table t2(a char(20), key(a), foreign key(a) references t1(f1)) engine=innodb;
|
create table t2(a char(20), key(a), foreign key(a) references t1(f1)) engine=innodb;
|
||||||
@@ -122,5 +122,5 @@ show warnings;
|
|||||||
Level Code Message
|
Level Code Message
|
||||||
Warning 150 Create table `test`.`t2` with foreign key constraint failed. Field type or character set for column 'a' does not mach referenced column 'f1' near 'foreign key(a) references t1(f1)) engine=innodb'.
|
Warning 150 Create table `test`.`t2` with foreign key constraint failed. Field type or character set for column 'a' does not mach referenced column 'f1' near 'foreign key(a) references t1(f1)) engine=innodb'.
|
||||||
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
||||||
Warning 1215 Cannot add foreign key constraint
|
Warning 1215 Cannot add foreign key constraint for `t2`
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ Level Code Message
|
|||||||
Warning 150 Create table `test`.`t2` with foreign key constraint failed. Referenced table `test`.`t3` not found in the data dictionary near ' FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE
|
Warning 150 Create table `test`.`t2` with foreign key constraint failed. Referenced table `test`.`t3` not found in the data dictionary near ' FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB'.
|
) ENGINE=InnoDB'.
|
||||||
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
||||||
Warning 1215 Cannot add foreign key constraint
|
Warning 1215 Cannot add foreign key constraint for `t2`
|
||||||
CREATE TABLE t2 (
|
CREATE TABLE t2 (
|
||||||
id int(11) NOT NULL AUTO_INCREMENT,
|
id int(11) NOT NULL AUTO_INCREMENT,
|
||||||
f2 int(11) NOT NULL,
|
f2 int(11) NOT NULL,
|
||||||
@@ -67,7 +67,7 @@ show warnings;
|
|||||||
Level Code Message
|
Level Code Message
|
||||||
Warning 150 Alter table `test`.`t2` with foreign key constraint failed. Referenced table `test`.`t3` not found in the data dictionary near ' FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE'.
|
Warning 150 Alter table `test`.`t2` with foreign key constraint failed. Referenced table `test`.`t3` not found in the data dictionary near ' FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE'.
|
||||||
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
|
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
|
||||||
Warning 1215 Cannot add foreign key constraint
|
Warning 1215 Cannot add foreign key constraint for `#sql-temporary`
|
||||||
drop table t2;
|
drop table t2;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
CREATE DATABASE kg_test1;
|
CREATE DATABASE kg_test1;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ ERROR HY000: Can't create table `bug_fk`.`b` (errno: 150 "Foreign key constraint
|
|||||||
show warnings;
|
show warnings;
|
||||||
Level Code Message
|
Level Code Message
|
||||||
Error 1005 Can't create table `bug_fk`.`b` (errno: 150 "Foreign key constraint is incorrectly formed")
|
Error 1005 Can't create table `bug_fk`.`b` (errno: 150 "Foreign key constraint is incorrectly formed")
|
||||||
Warning 1215 Cannot add foreign key constraint
|
Warning 1215 Cannot add foreign key constraint for `b`
|
||||||
DROP TABLE IF EXISTS d;
|
DROP TABLE IF EXISTS d;
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1051 Unknown table 'bug_fk.d'
|
Note 1051 Unknown table 'bug_fk.d'
|
||||||
@@ -76,7 +76,7 @@ ERROR HY000: Can't create table `bug_fk`.`b` (errno: 150 "Foreign key constraint
|
|||||||
show warnings;
|
show warnings;
|
||||||
Level Code Message
|
Level Code Message
|
||||||
Error 1005 Can't create table `bug_fk`.`b` (errno: 150 "Foreign key constraint is incorrectly formed")
|
Error 1005 Can't create table `bug_fk`.`b` (errno: 150 "Foreign key constraint is incorrectly formed")
|
||||||
Warning 1215 Cannot add foreign key constraint
|
Warning 1215 Cannot add foreign key constraint for `b`
|
||||||
set foreign_key_checks=0;
|
set foreign_key_checks=0;
|
||||||
drop table c;
|
drop table c;
|
||||||
drop table d;
|
drop table d;
|
||||||
|
|||||||
@@ -1526,7 +1526,7 @@ show warnings;
|
|||||||
Level Code Message
|
Level Code Message
|
||||||
Warning 150 Alter table '`test`.`child`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns near 'FOREIGN KEY(p) REFERENCES parent(p)'.
|
Warning 150 Alter table '`test`.`child`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns near 'FOREIGN KEY(p) REFERENCES parent(p)'.
|
||||||
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
|
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
|
||||||
Warning 1215 Cannot add foreign key constraint
|
Warning 1215 Cannot add foreign key constraint for `#sql-temporary`
|
||||||
ALTER TABLE parent DROP INDEX idx1;
|
ALTER TABLE parent DROP INDEX idx1;
|
||||||
ALTER TABLE child ADD FOREIGN KEY(p) REFERENCES parent(p);
|
ALTER TABLE child ADD FOREIGN KEY(p) REFERENCES parent(p);
|
||||||
Got one of the listed errors
|
Got one of the listed errors
|
||||||
@@ -1534,7 +1534,7 @@ show warnings;
|
|||||||
Level Code Message
|
Level Code Message
|
||||||
Warning 150 Alter table '`test`.`child`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns near 'FOREIGN KEY(p) REFERENCES parent(p)'.
|
Warning 150 Alter table '`test`.`child`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns near 'FOREIGN KEY(p) REFERENCES parent(p)'.
|
||||||
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
|
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
|
||||||
Warning 1215 Cannot add foreign key constraint
|
Warning 1215 Cannot add foreign key constraint for `#sql-temporary`
|
||||||
ALTER TABLE child DROP INDEX idx2;
|
ALTER TABLE child DROP INDEX idx2;
|
||||||
ALTER TABLE child ADD FOREIGN KEY(p) REFERENCES parent(p);
|
ALTER TABLE child ADD FOREIGN KEY(p) REFERENCES parent(p);
|
||||||
Got one of the listed errors
|
Got one of the listed errors
|
||||||
@@ -1542,7 +1542,7 @@ show warnings;
|
|||||||
Level Code Message
|
Level Code Message
|
||||||
Warning 150 Alter table '`test`.`child`' with foreign key constraint failed. There is only prefix index in the referenced table where the referenced columns appear as the first columns near 'FOREIGN KEY(p) REFERENCES parent(p)'.
|
Warning 150 Alter table '`test`.`child`' with foreign key constraint failed. There is only prefix index in the referenced table where the referenced columns appear as the first columns near 'FOREIGN KEY(p) REFERENCES parent(p)'.
|
||||||
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
|
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
|
||||||
Warning 1215 Cannot add foreign key constraint
|
Warning 1215 Cannot add foreign key constraint for `#sql-temporary`
|
||||||
DROP TABLE child, parent;
|
DROP TABLE child, parent;
|
||||||
#
|
#
|
||||||
# Bug#28763: Selecting geometry fields in UNION caused server crash.
|
# Bug#28763: Selecting geometry fields in UNION caused server crash.
|
||||||
|
|||||||
@@ -4899,7 +4899,8 @@ int ha_create_table(THD *thd, const char *path,
|
|||||||
|
|
||||||
share.m_psi= PSI_CALL_get_table_share(temp_table, &share);
|
share.m_psi= PSI_CALL_get_table_share(temp_table, &share);
|
||||||
|
|
||||||
if (open_table_from_share(thd, &share, &empty_clex_str, 0, READ_ALL, 0, &table, true))
|
if (open_table_from_share(thd, &share, &empty_clex_str, 0, READ_ALL, 0,
|
||||||
|
&table, true))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
update_create_info_from_table(create_info, &table);
|
update_create_info_from_table(create_info, &table);
|
||||||
|
|||||||
@@ -4528,18 +4528,18 @@ ER_TABLE_CANT_HANDLE_FT
|
|||||||
spa "El tipo de tabla usada (%s) no soporta índices FULLTEXT"
|
spa "El tipo de tabla usada (%s) no soporta índices FULLTEXT"
|
||||||
swe "Tabelltypen (%s) har inte hantering av FULLTEXT-index"
|
swe "Tabelltypen (%s) har inte hantering av FULLTEXT-index"
|
||||||
ukr "Використаний тип таблиці (%s) не підтримує FULLTEXT індексів"
|
ukr "Використаний тип таблиці (%s) не підтримує FULLTEXT індексів"
|
||||||
ER_CANNOT_ADD_FOREIGN
|
ER_CANNOT_ADD_FOREIGN
|
||||||
nla "Kan foreign key beperking niet toevoegen"
|
nla "Kan foreign key beperking niet toevoegen vor `%s`"
|
||||||
eng "Cannot add foreign key constraint"
|
eng "Cannot add foreign key constraint for `%s`"
|
||||||
fre "Impossible d'ajouter des contraintes d'index externe"
|
fre "Impossible d'ajouter des contraintes d'index externe à `%s`"
|
||||||
ger "Fremdschlüssel-Beschränkung kann nicht hinzugefügt werden"
|
ger "Fremdschlüssel-Beschränkung kann nicht hinzugefügt werden für `%s`"
|
||||||
ita "Impossibile aggiungere il vincolo di integrita' referenziale (foreign key constraint)"
|
ita "Impossibile aggiungere il vincolo di integrita' referenziale (foreign key constraint) a `%s`"
|
||||||
jpn "外部キー制約を追加できません。"
|
jpn "`%s` 外部キー制約を追加できません。"
|
||||||
por "Não pode acrescentar uma restrição de chave estrangeira"
|
por "Não pode acrescentar uma restrição de chave estrangeira para `%s`"
|
||||||
rus "Невозможно добавить ограничения внешнего ключа"
|
rus "Невозможно добавить ограничения внешнего ключа для `%s`"
|
||||||
serbian "Ne mogu da dodam proveru spoljnog ključa"
|
serbian "Ne mogu da dodam proveru spoljnog ključa na `%s`"
|
||||||
spa "No puede adicionar clave extranjera constraint"
|
spa "No puede adicionar clave extranjera constraint para `%s`"
|
||||||
swe "Kan inte lägga till 'FOREIGN KEY constraint'"
|
swe "Kan inte lägga till 'FOREIGN KEY constraint' för `%s`'"
|
||||||
ER_NO_REFERENCED_ROW 23000
|
ER_NO_REFERENCED_ROW 23000
|
||||||
nla "Kan onderliggende rij niet toevoegen: foreign key beperking gefaald"
|
nla "Kan onderliggende rij niet toevoegen: foreign key beperking gefaald"
|
||||||
eng "Cannot add or update a child row: a foreign key constraint fails"
|
eng "Cannot add or update a child row: a foreign key constraint fails"
|
||||||
|
|||||||
@@ -1799,7 +1799,7 @@ innobase_get_foreign_key_info(
|
|||||||
/* Not possible to add a foreign key without a
|
/* Not possible to add a foreign key without a
|
||||||
referenced column */
|
referenced column */
|
||||||
mutex_exit(&dict_sys->mutex);
|
mutex_exit(&dict_sys->mutex);
|
||||||
my_error(ER_CANNOT_ADD_FOREIGN, MYF(0));
|
my_error(ER_CANNOT_ADD_FOREIGN, MYF(0), tbl_namep);
|
||||||
goto err_exit;
|
goto err_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user