mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 18:41:56 +01:00
024a18dbcb
In the bug report MDEV-32817 it occurred that the function row_mysql_get_table_status() is outputting a fil_space_t* as if it were a numeric tablespace identifier. ib_push_warning(): Remove. Let us invoke push_warning_printf() directly. innodb_decryption_failed(): Report a decryption failure and set the dict_table_t::file_unreadable flag. This code was being duplicated in very many places. We return the constant value DB_DECRYPTION_FAILED in order to avoid code duplication in the callers and to allow tail calls. innodb_fk_error(): Report a FOREIGN KEY error. dict_foreign_def_get(), dict_foreign_def_get_fields(): Remove. This code was being used in dict_create_add_foreign_to_dictionary() in an apparently uncovered code path. That ib_push_warning() call would pass the integer i+1 instead of a pointer to NUL terminated string ("%s"), and therefore the call should have resulted in a crash. dict_print_info_on_foreign_key_in_create_format(), innobase_quote_identifier(): Add const qualifiers. row_mysql_get_table_error(): Replaces row_mysql_get_table_status(). Display no message on DB_CORRUPTION; it should be properly reported at the SQL layer anyway.
135 lines
8.5 KiB
Text
135 lines
8.5 KiB
Text
CREATE TABLE t1 (
|
|
id int(11) NOT NULL PRIMARY KEY,
|
|
a int(11) NOT NULL,
|
|
b int(11) NOT NULL,
|
|
c int not null,
|
|
CONSTRAINT test FOREIGN KEY (b) REFERENCES t1 (id)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
|
CREATE TABLE t2 (
|
|
id int(11) NOT NULL PRIMARY KEY,
|
|
a int(11) NOT NULL,
|
|
b int(11) NOT NULL,
|
|
c int not null,
|
|
CONSTRAINT mytest FOREIGN KEY (c) REFERENCES t1(id),
|
|
CONSTRAINT test FOREIGN KEY (b) REFERENCES t2 (id)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
|
ERROR HY000: Can't create table `test`.`t2` (errno: 121 "Duplicate key on write or update")
|
|
show warnings;
|
|
Level Code Message
|
|
Warning 121 CREATE or ALTER TABLE `test`.`t2` failed: duplicate name, CONSTRAINT `test` FOREIGN KEY (`b`) REFERENCES `t2` (`id`)
|
|
Error 1005 Can't create table `test`.`t2` (errno: 121 "Duplicate key on write or update")
|
|
Warning 1022 Can't write; duplicate key in table 't2'
|
|
drop table t1;
|
|
create table t1(a int) engine=innodb;
|
|
create table t2(a int, constraint a foreign key a (a) references t1(a)) engine=innodb;
|
|
ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
|
show warnings;
|
|
Level Code Message
|
|
Warning 150 Create table `test`.`t2` with foreign key `a` constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns.
|
|
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
|
Warning 1215 Cannot add foreign key constraint for `t2`
|
|
drop table t1;
|
|
create table t1(a int unique, b int) engine=innodb;
|
|
create table t2(a int, b int, foreign key (a) references t1(a), foreign key (b) references t1(b)) engine=innodb;
|
|
ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
|
show warnings;
|
|
Level Code Message
|
|
Warning 150 Create table `test`.`t2` with foreign key (b) constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns.
|
|
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
|
Warning 1215 Cannot add foreign key constraint for `t2`
|
|
drop table t1;
|
|
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),
|
|
constraint a foreign key a (a) references t1(b)) engine=innodb;
|
|
ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
|
show warnings;
|
|
Level Code Message
|
|
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
|
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;
|
|
alter table t2 add constraint b foreign key (b) references t2(b);
|
|
ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
|
show warnings;
|
|
Level Code Message
|
|
Warning 150 Alter table `test`.`t2` with foreign key `b` constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns.
|
|
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
|
Warning 1215 Cannot add foreign key constraint for `t2`
|
|
drop table t2, t1;
|
|
create table t1 (f1 integer primary key) engine=innodb;
|
|
alter table t1 add constraint c1 foreign key (f1) references t11(f1);
|
|
ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
|
|
show warnings;
|
|
Level Code Message
|
|
Warning 150 Alter table `test`.`t1` with foreign key `c1` constraint failed. Referenced table `test`.`t11` not found in the data dictionary.
|
|
Error 1005 Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
|
|
Warning 1215 Cannot add foreign key constraint for `t1`
|
|
drop table t1;
|
|
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;
|
|
ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
|
show warnings;
|
|
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 close to foreign key(a) references t1(a)) engine=innodb.
|
|
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
|
Warning 1215 Cannot add foreign key constraint
|
|
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")
|
|
show warnings;
|
|
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 close to foreign key(b) references t1(a).
|
|
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
|
|
Warning 1215 Cannot add foreign key constraint
|
|
create temporary table t2(a int, foreign key(a) references t1(a)) engine=innodb;
|
|
ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
|
show warnings;
|
|
Level Code Message
|
|
Warning 150 Create table `test`.`t2` with foreign key constraint failed. Temporary tables can't have foreign key constraints.
|
|
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
|
Warning 1215 Cannot add foreign key constraint for `t2`
|
|
alter table t1 add foreign key(b) references t1(a);
|
|
ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
|
|
show warnings;
|
|
Level Code Message
|
|
Warning 150 Alter table `test`.`t1` with foreign key constraint failed. Temporary tables can't have foreign key constraints.
|
|
Error 1005 Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
|
|
Warning 1215 Cannot add foreign key constraint for `t1`
|
|
drop table t1;
|
|
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);
|
|
ERROR 42000: Incorrect foreign key definition for 'foreign key without name': Key reference and table reference don't match
|
|
show warnings;
|
|
Level Code Message
|
|
Error 1239 Incorrect foreign key definition for 'foreign key without name': Key reference and table reference don't match
|
|
drop table t1;
|
|
create table t1(a int not null primary key, b int, key(b)) engine=innodb;
|
|
alter table t1 add foreign key(a) references t1(a,b);
|
|
ERROR 42000: Incorrect foreign key definition for 'foreign key without name': Key reference and table reference don't match
|
|
show warnings;
|
|
Level Code Message
|
|
Error 1239 Incorrect foreign key definition for 'foreign key without name': Key reference and table reference don't match
|
|
drop table t1;
|
|
create table t1 (f1 integer not null primary key) engine=innodb;
|
|
alter table t1 add constraint c1 foreign key (f1) references t1(f1) on update set null;
|
|
ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
|
|
show warnings;
|
|
Level Code Message
|
|
Warning 150 Alter table `test`.`t1` with foreign key `c1` constraint failed. You have defined a SET NULL condition but column 'f1' is defined as NOT NULL.
|
|
Error 1005 Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
|
|
Warning 1215 Cannot add foreign key constraint for `t1`
|
|
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")
|
|
show warnings;
|
|
Level Code Message
|
|
Warning 150 Create table `test`.`t2` with foreign key (a) constraint failed. You have defined a SET NULL condition but column 'a' is defined as NOT NULL.
|
|
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
|
Warning 1215 Cannot add foreign key constraint for `t2`
|
|
drop table t1;
|
|
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;
|
|
ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
|
show warnings;
|
|
Level Code Message
|
|
Warning 150 Create table `test`.`t2` with foreign key (a) constraint failed. Field type or character set for column 'a' does not match referenced column 'f1'.
|
|
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
|
Warning 1215 Cannot add foreign key constraint for `t2`
|
|
drop table t1;
|