# MDEV-4410: update does not want to use a covering index, but select uses it.
# MDEV-8938: Server Crash on Update with joins
#
#
create table t2(a int);
CREATE TABLE `t1` (
insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
`name` varchar(255) NOT NULL,
create table t1 (key1 int, col1 int, key(key1));
`value` varchar(4095) DEFAULT NULL,
insert into t1
PRIMARY KEY (`name`)
select A.a + 10 * B.a + 100 * C.a, 1234 from t2 A, t2 B, t2 C;
);
# This must not have "Using filesort":
UPDATE `t1` SET value = CONCAT("*.",(SELECT `temptable`.`value` FROM (SELECT * FROM `t1` WHERE `name`="consoleproxy.url.domain") AS `temptable` WHERE `temptable`.`name`="consoleproxy.url.domain")) WHERE `name`="consoleproxy.url.domain";
explain
drop table t1;
update t1 set key1=key1+1 where key1 between 10 and 110 order by key1 limit 2;
CREATE TABLE `t1` (
id select_type table type possible_keys key key_len ref rows Extra
`name` varchar(255) NOT NULL,
1 SIMPLE t1 range key1 key1 5 NULL 2 Using where; Using buffer
`value` varchar(4095) DEFAULT NULL,
flush status;
PRIMARY KEY (`name`)
update t1 set key1=key1+1 where key1 between 10 and 110 order by key1 limit 2;
);
show status like 'Handler_read%';
create table t2 (
Variable_name Value
`name` varchar(255) NOT NULL,
Handler_read_first 0
`value` varchar(4095) DEFAULT NULL,
Handler_read_key 1
PRIMARY KEY (`name`)
Handler_read_last 0
);
Handler_read_next 1
UPDATE t1
Handler_read_prev 0
SET value = (SELECT value FROM t2 WHERE `name`= t1.name)
Handler_read_rnd 2
WHERE value is null ;
Handler_read_rnd_deleted 0
drop table t1,t2;
Handler_read_rnd_next 0
drop table t1, t2;
#
#
#MDEV-8701: Crash on derived query
#MDEV-8701: Crash on derived query
#
#
...
@@ -679,4 +677,30 @@ WHERE data_entry_exit_id = t2.data_entry_id
...
@@ -679,4 +677,30 @@ WHERE data_entry_exit_id = t2.data_entry_id
);
);
drop view v1;
drop view v1;
drop table t1, t2;
drop table t1, t2;
#
# MDEV-4410: update does not want to use a covering index, but select uses it.
#
create table t2(a int);
insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1 (key1 int, col1 int, key(key1));
insert into t1
select A.a + 10 * B.a + 100 * C.a, 1234 from t2 A, t2 B, t2 C;
# This must not have "Using filesort":
explain
update t1 set key1=key1+1 where key1 between 10 and 110 order by key1 limit 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range key1 key1 5 NULL 2 Using where; Using buffer
flush status;
update t1 set key1=key1+1 where key1 between 10 and 110 order by key1 limit 2;
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. Error close to 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'.
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. Error close to 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)'.
Warning 150 Alter table `test`.`t1` with foreign key constraint failed. Referenced table `test`.`t11` not found in the data dictionary close to 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)'.
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 close to 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'.
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 close to 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'.
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 close to 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'.
Warning 150 Create table `test`.`t2` with foreign key constraint failed. Referenced table `test`.`t3` not found in the data dictionary close to 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
Warning 150 Alter table `test`.`t2` with foreign key constraint failed. Referenced table `test`.`t3` not found in the data dictionary close to 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'.