Commit 4b821e02 authored by Alexander Barkov's avatar Alexander Barkov

Merge remote-tracking branch 'origin/10.0' into 10.1

parents bb24663f 6c08ff3e
......@@ -537,3 +537,32 @@ pk
-5
1
drop table t1;
#
# Start of 5.5 tests
#
#
# MDEV-16534 PPC64: Unexpected error with a negative values into auto-increment columns in HEAP, MyISAM, ARIA
#
CREATE TABLE t1 (
id TINYINT NOT NULL AUTO_INCREMENT,
name CHAR(30) NOT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` tinyint(4) NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 (name) VALUES ('dog');
UPDATE t1 SET id=-1 WHERE id=1;
INSERT INTO t1 (name) VALUES ('cat');
SELECT * FROM t1;
id name
-1 dog
2 cat
DROP TABLE t1;
#
# End of 5.5 tests
#
......@@ -1712,3 +1712,93 @@ id
12
13
drop table t1;
#
# MDEV-15247: Crash when SET NAMES 'utf8' is set
#
CREATE TABLE t1 (
id_category int unsigned,
id_product int unsigned,
PRIMARY KEY (id_category,id_product)
) ENGINE=MyISAM;
INSERT INTO `t1` VALUES (31,216), (31,215), (31,214), (31,213), (31,212), (32,211), (32,210), (32,209), (32,208), (29,207), (30,315372), (2,161), (2,132), (33,315380), (31,315371), (29,315370), (29,315373), (29,315369), (29,315374), (29,315368), (29,315375), (29,315367), (29,183), (29,182), (30,177), (29,315376), (13,315365), (2,167), (2,315357), (2,164), (2,159), (2,131), (2,127), (14,315364), (27,315363), (29,205), (29,204), (29,203), (29,202), (29,201), (29,200), (29,199), (29,198), (29,197), (29,196), (29,195), (29,194), (29,193), (29,192), (29,191), (29,190), (29,189), (14,188), (29,187), (29,186), (29,185), (29,184), (29,315377), (29,315378), (29,181), (33,315379), (29,179), (30,178), (29,180), (30,176), (30,175), (30,174), (30,173), (30,172), (11,171), (27,315357), (23,108), (23,102);
CREATE TABLE t2 (
id_product int,
id_t2 int,
KEY id_t2 (id_t2),
KEY id_product (id_product)
) ENGINE=MyISAM;
INSERT INTO `t2` VALUES (11,31), (11,31), (11,31), (11,32), (11,32),
(11,32), (10,26), (11,32), (10,28), (11,32), (10,29), (11,33), (10,26),
(11,33), (10,27), (9,23), (11,32), (10,26), (8,18), (7,15), (11,32),
(10,28), (11,32), (10,28), (11,32), (10,29), (11,32), (10,29), (8,19),
(7,16), (8,18), (7,16), (8,20), (7,16), (11,32), (10,28), (8,19),
(7,16), (8,20), (7,16), (11,32), (10,29), (8,19), (7,16), (8,20),
(7,16), (10,27), (9,23), (10,27), (9,23), (10,27), (9,23), (11,32),
(10,27), (11,32), (10,27), (8,18), (7,15), (10,26), (9,24), (8,19),
(7,16), (10,26), (9,23), (8,19), (7,16), (8,18), (7,16), (8,18), (7,16),
(9,23), (8,18), (9,23), (8,19), (7,16), (7,16), (8,19), (7,16), (11,31),
(10,27), (9,24), (11,31), (10,27), (9,23), (8,19), (11,31), (10,26), (9,24),
(8,19), (11,31), (10,26), (9,25), (8,18), (11,31), (10,26), (9,23), (8,19),
(11,31), (10,26), (9,23), (8,18), (11,31), (10,30), (9,23), (8,18), (11,31),
(10,30), (9,23), (8,19), (11,31), (10,26), (9,25), (8,19), (8,21), (11,32),
(10,26), (9,22), (8,19), (11,32), (10,26), (9,22), (8,18), (11,32), (10,26),
(9,22), (8,20), (11,33), (10,26), (9,22), (8,19), (11,33), (10,26), (9,22),
(8,18), (11,33), (10,26), (9,22), (8,20), (11,32), (10,26), (9,24), (8,19),
(11,32), (10,26), (9,25), (8,19), (11,32), (10,26), (9,25), (8,18), (11,32),
(10,26), (9,23), (8,18), (11,32), (10,30), (9,23), (8,18), (11,32), (10,30),
(9,23), (8,19), (11,32), (10,26), (9,23), (8,19), (11,32), (10,27), (9,23),
(11,32), (10,27), (9,23), (11,32), (10,27), (9,23), (10,26), (9,22), (8,19),
(7,15), (10,26), (9,22), (8,20), (7,15), (10,26), (9,22), (8,18), (7,15),
(8,19), (10,26), (10,26), (11,33), (10,26), (11,33), (10,26), (11,33),
(10,27), (11,33), (10,27), (11,31), (10,26), (11,31), (10,26), (8,18),
(7,15), (9,23), (9,23), (9,24), (8,21), (7,15), (7,15), (7,15), (7,15),
(7,15), (7,15), (7,15), (7,15), (7,15), (8,18), (7,17), (8,18), (7,17), (8,19), (8,19);
CREATE TABLE t3 (
id_product int unsigned,
PRIMARY KEY (id_product)
) ENGINE=MyISAM;
INSERT INTO t3 VALUES
(102),(103),(104),(105),(106),(107),(108),(109),(110),
(315371),(315373),(315374),(315375),(315376),(315377),
(315378),(315379),(315380);
CREATE TABLE t4 (
id_product int not null,
id_shop int,
PRIMARY KEY (id_product,id_shop)
) ENGINE=MyISAM ;
INSERT INTO t4 VALUES
(202,1),(201,1),(200,1),(199,1),(198,1),(197,1),(196,1),(195,1),
(194,1),(193,1),(192,1),(191,1),(190,1),(189,1),(188,1),(187,1),
(186,1),(185,1),(184,1),(183,1),(182,1),(181,1),(179,1),(178,1),
(177,1),(176,1),(126,1),(315380,1);
CREATE TABLE t5 (id_product int) ENGINE=MyISAM;
INSERT INTO `t5` VALUES
(652),(668),(669),(670),(671),(673),(674),(675),(676),
(677),(679),(680),(681),(682),(683),(684),(685),(686);
explain
SELECT * FROM t3
JOIN t4 ON (t4.id_product = t3.id_product AND t4.id_shop = 1)
JOIN t1 ON (t1.id_product = t3.id_product)
LEFT JOIN t5 ON (t5.id_product = t3.id_product)
WHERE 1=1
AND t3.id_product IN (SELECT id_product FROM t2 t2_1 WHERE t2_1.id_t2 = 32)
AND t3.id_product IN (SELECT id_product FROM t2 t2_2 WHERE t2_2.id_t2 = 15)
AND t3.id_product IN (SELECT id_product FROM t2 t2_3 WHERE t2_3.id_t2 = 18 OR t2_3.id_t2 = 19)
AND t3.id_product IN (SELECT id_product FROM t2 t2_4 WHERE t2_4.id_t2 = 34 OR t2_4.id_t2 = 23)
AND t3.id_product IN (SELECT id_product FROM t2 t2_5 WHERE t2_5.id_t2 = 29 OR t2_5.id_t2 = 28 OR t2_5.id_t2 = 26);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL PRIMARY 8 NULL 73 Using index
1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.id_product 1 Using index
1 PRIMARY <subquery5> eq_ref distinct_key distinct_key 4 func 1 Using where
1 PRIMARY <subquery4> eq_ref distinct_key distinct_key 4 func 1 Using where
1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 Using where
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 Using where
1 PRIMARY t4 eq_ref PRIMARY PRIMARY 8 test.t1.id_product,const 1 Using where; Using index
1 PRIMARY <subquery6> eq_ref distinct_key distinct_key 4 func 1 Using where
1 PRIMARY t5 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
5 MATERIALIZED t2_4 range id_t2,id_product id_t2 5 NULL 18 Using index condition; Using where
4 MATERIALIZED t2_3 range id_t2,id_product id_t2 5 NULL 32 Using index condition; Using where
3 MATERIALIZED t2_2 ref id_t2,id_product id_t2 5 const 12
2 MATERIALIZED t2_1 ref id_t2,id_product id_t2 5 const 50
6 MATERIALIZED t2_5 range id_t2,id_product id_t2 5 NULL 30 Using index condition; Using where
drop table t1,t2,t3,t4,t5;
......@@ -39,3 +39,32 @@ _rowid _rowid skey sval
1 1 1 hello
2 2 2 hey
drop table t1;
#
# Start of 5.5 tests
#
#
# MDEV-16534 PPC64: Unexpected error with a negative values into auto-increment columns in HEAP, MyISAM, ARIA
#
CREATE TABLE t1 (
id TINYINT NOT NULL AUTO_INCREMENT,
name CHAR(30) NOT NULL,
PRIMARY KEY (id)
) ENGINE=MEMORY;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` tinyint(4) NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1
INSERT INTO t1 (name) VALUES ('dog');
UPDATE t1 SET id=-1 WHERE id=1;
INSERT INTO t1 (name) VALUES ('cat');
SELECT * FROM t1;
id name
-1 dog
2 cat
DROP TABLE t1;
#
# End of 5.5 tests
#
......@@ -33,3 +33,28 @@ select _rowid,t1._rowid,skey,sval from t1;
drop table t1;
# End of 4.1 tests
--echo #
--echo # Start of 5.5 tests
--echo #
--echo #
--echo # MDEV-16534 PPC64: Unexpected error with a negative values into auto-increment columns in HEAP, MyISAM, ARIA
--echo #
CREATE TABLE t1 (
id TINYINT NOT NULL AUTO_INCREMENT,
name CHAR(30) NOT NULL,
PRIMARY KEY (id)
) ENGINE=MEMORY;
SHOW CREATE TABLE t1;
INSERT INTO t1 (name) VALUES ('dog');
UPDATE t1 SET id=-1 WHERE id=1;
INSERT INTO t1 (name) VALUES ('cat');
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # End of 5.5 tests
--echo #
......@@ -2707,6 +2707,35 @@ INSERT INTO t1 (b) VALUES ('');
ALTER TABLE t1 ENABLE KEYS;
DROP TABLE t1;
#
# Start of 5.5 tests
#
#
# MDEV-16534 PPC64: Unexpected error with a negative values into auto-increment columns in HEAP, MyISAM, ARIA
#
CREATE TABLE t1 (
id TINYINT NOT NULL AUTO_INCREMENT,
name CHAR(30) NOT NULL,
PRIMARY KEY (id)
) ENGINE=ARIA;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` tinyint(4) NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0
INSERT INTO t1 (name) VALUES ('dog');
UPDATE t1 SET id=-1 WHERE id=1;
INSERT INTO t1 (name) VALUES ('cat');
SELECT * FROM t1;
id name
-1 dog
2 cat
DROP TABLE t1;
#
# End of 5.5 tests
#
#
# BUG#47444 - --myisam_repair_threads > 1 can result in all index
# cardinalities=1
#
......
......@@ -1982,6 +1982,30 @@ ALTER TABLE t1 ENABLE KEYS;
# Cleanup
DROP TABLE t1;
--echo #
--echo # Start of 5.5 tests
--echo #
--echo #
--echo # MDEV-16534 PPC64: Unexpected error with a negative values into auto-increment columns in HEAP, MyISAM, ARIA
--echo #
CREATE TABLE t1 (
id TINYINT NOT NULL AUTO_INCREMENT,
name CHAR(30) NOT NULL,
PRIMARY KEY (id)
) ENGINE=ARIA;
SHOW CREATE TABLE t1;
INSERT INTO t1 (name) VALUES ('dog');
UPDATE t1 SET id=-1 WHERE id=1;
INSERT INTO t1 (name) VALUES ('cat');
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # End of 5.5 tests
--echo #
--echo #
--echo # BUG#47444 - --myisam_repair_threads > 1 can result in all index
--echo # cardinalities=1
......
......@@ -397,3 +397,28 @@ insert into t1 values(null);
select last_insert_id();
select * from t1;
drop table t1;
--echo #
--echo # Start of 5.5 tests
--echo #
--echo #
--echo # MDEV-16534 PPC64: Unexpected error with a negative values into auto-increment columns in HEAP, MyISAM, ARIA
--echo #
CREATE TABLE t1 (
id TINYINT NOT NULL AUTO_INCREMENT,
name CHAR(30) NOT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM;
SHOW CREATE TABLE t1;
INSERT INTO t1 (name) VALUES ('dog');
UPDATE t1 SET id=-1 WHERE id=1;
INSERT INTO t1 (name) VALUES ('cat');
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # End of 5.5 tests
--echo #
......@@ -345,3 +345,90 @@ WHERE (
(t.id IN (0,4,12,13,1,10,3,11))
);
drop table t1;
--echo #
--echo # MDEV-15247: Crash when SET NAMES 'utf8' is set
--echo #
CREATE TABLE t1 (
id_category int unsigned,
id_product int unsigned,
PRIMARY KEY (id_category,id_product)
) ENGINE=MyISAM;
INSERT INTO `t1` VALUES (31,216), (31,215), (31,214), (31,213), (31,212), (32,211), (32,210), (32,209), (32,208), (29,207), (30,315372), (2,161), (2,132), (33,315380), (31,315371), (29,315370), (29,315373), (29,315369), (29,315374), (29,315368), (29,315375), (29,315367), (29,183), (29,182), (30,177), (29,315376), (13,315365), (2,167), (2,315357), (2,164), (2,159), (2,131), (2,127), (14,315364), (27,315363), (29,205), (29,204), (29,203), (29,202), (29,201), (29,200), (29,199), (29,198), (29,197), (29,196), (29,195), (29,194), (29,193), (29,192), (29,191), (29,190), (29,189), (14,188), (29,187), (29,186), (29,185), (29,184), (29,315377), (29,315378), (29,181), (33,315379), (29,179), (30,178), (29,180), (30,176), (30,175), (30,174), (30,173), (30,172), (11,171), (27,315357), (23,108), (23,102);
CREATE TABLE t2 (
id_product int,
id_t2 int,
KEY id_t2 (id_t2),
KEY id_product (id_product)
) ENGINE=MyISAM;
INSERT INTO `t2` VALUES (11,31), (11,31), (11,31), (11,32), (11,32),
(11,32), (10,26), (11,32), (10,28), (11,32), (10,29), (11,33), (10,26),
(11,33), (10,27), (9,23), (11,32), (10,26), (8,18), (7,15), (11,32),
(10,28), (11,32), (10,28), (11,32), (10,29), (11,32), (10,29), (8,19),
(7,16), (8,18), (7,16), (8,20), (7,16), (11,32), (10,28), (8,19),
(7,16), (8,20), (7,16), (11,32), (10,29), (8,19), (7,16), (8,20),
(7,16), (10,27), (9,23), (10,27), (9,23), (10,27), (9,23), (11,32),
(10,27), (11,32), (10,27), (8,18), (7,15), (10,26), (9,24), (8,19),
(7,16), (10,26), (9,23), (8,19), (7,16), (8,18), (7,16), (8,18), (7,16),
(9,23), (8,18), (9,23), (8,19), (7,16), (7,16), (8,19), (7,16), (11,31),
(10,27), (9,24), (11,31), (10,27), (9,23), (8,19), (11,31), (10,26), (9,24),
(8,19), (11,31), (10,26), (9,25), (8,18), (11,31), (10,26), (9,23), (8,19),
(11,31), (10,26), (9,23), (8,18), (11,31), (10,30), (9,23), (8,18), (11,31),
(10,30), (9,23), (8,19), (11,31), (10,26), (9,25), (8,19), (8,21), (11,32),
(10,26), (9,22), (8,19), (11,32), (10,26), (9,22), (8,18), (11,32), (10,26),
(9,22), (8,20), (11,33), (10,26), (9,22), (8,19), (11,33), (10,26), (9,22),
(8,18), (11,33), (10,26), (9,22), (8,20), (11,32), (10,26), (9,24), (8,19),
(11,32), (10,26), (9,25), (8,19), (11,32), (10,26), (9,25), (8,18), (11,32),
(10,26), (9,23), (8,18), (11,32), (10,30), (9,23), (8,18), (11,32), (10,30),
(9,23), (8,19), (11,32), (10,26), (9,23), (8,19), (11,32), (10,27), (9,23),
(11,32), (10,27), (9,23), (11,32), (10,27), (9,23), (10,26), (9,22), (8,19),
(7,15), (10,26), (9,22), (8,20), (7,15), (10,26), (9,22), (8,18), (7,15),
(8,19), (10,26), (10,26), (11,33), (10,26), (11,33), (10,26), (11,33),
(10,27), (11,33), (10,27), (11,31), (10,26), (11,31), (10,26), (8,18),
(7,15), (9,23), (9,23), (9,24), (8,21), (7,15), (7,15), (7,15), (7,15),
(7,15), (7,15), (7,15), (7,15), (7,15), (8,18), (7,17), (8,18), (7,17), (8,19), (8,19);
CREATE TABLE t3 (
id_product int unsigned,
PRIMARY KEY (id_product)
) ENGINE=MyISAM;
INSERT INTO t3 VALUES
(102),(103),(104),(105),(106),(107),(108),(109),(110),
(315371),(315373),(315374),(315375),(315376),(315377),
(315378),(315379),(315380);
CREATE TABLE t4 (
id_product int not null,
id_shop int,
PRIMARY KEY (id_product,id_shop)
) ENGINE=MyISAM ;
INSERT INTO t4 VALUES
(202,1),(201,1),(200,1),(199,1),(198,1),(197,1),(196,1),(195,1),
(194,1),(193,1),(192,1),(191,1),(190,1),(189,1),(188,1),(187,1),
(186,1),(185,1),(184,1),(183,1),(182,1),(181,1),(179,1),(178,1),
(177,1),(176,1),(126,1),(315380,1);
CREATE TABLE t5 (id_product int) ENGINE=MyISAM;
INSERT INTO `t5` VALUES
(652),(668),(669),(670),(671),(673),(674),(675),(676),
(677),(679),(680),(681),(682),(683),(684),(685),(686);
explain
SELECT * FROM t3
JOIN t4 ON (t4.id_product = t3.id_product AND t4.id_shop = 1)
JOIN t1 ON (t1.id_product = t3.id_product)
LEFT JOIN t5 ON (t5.id_product = t3.id_product)
WHERE 1=1
AND t3.id_product IN (SELECT id_product FROM t2 t2_1 WHERE t2_1.id_t2 = 32)
AND t3.id_product IN (SELECT id_product FROM t2 t2_2 WHERE t2_2.id_t2 = 15)
AND t3.id_product IN (SELECT id_product FROM t2 t2_3 WHERE t2_3.id_t2 = 18 OR t2_3.id_t2 = 19)
AND t3.id_product IN (SELECT id_product FROM t2 t2_4 WHERE t2_4.id_t2 = 34 OR t2_4.id_t2 = 23)
AND t3.id_product IN (SELECT id_product FROM t2 t2_5 WHERE t2_5.id_t2 = 29 OR t2_5.id_t2 = 28 OR t2_5.id_t2 = 26);
drop table t1,t2,t3,t4,t5;
......@@ -9791,7 +9791,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
table_map current_map;
i= join->const_tables;
for (tab= first_depth_first_tab(join); tab;
tab= next_depth_first_tab(join, tab), i++)
tab= next_depth_first_tab(join, tab))
{
bool is_hj;
/*
......@@ -10275,6 +10275,8 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
}
first_inner_tab= first_inner_tab->first_upper;
}
if (!tab->bush_children)
i++;
}
}
DBUG_RETURN(0);
......
......@@ -1011,7 +1011,7 @@ void heap_update_auto_increment(HP_INFO *info, const uchar *record)
switch (info->s->auto_key_type) {
case HA_KEYTYPE_INT8:
s_value= (longlong) *(char*)key;
s_value= (longlong) *(const signed char*) key;
break;
case HA_KEYTYPE_BINARY:
value=(ulonglong) *(uchar*) key;
......
......@@ -728,7 +728,7 @@ ulonglong ma_retrieve_auto_increment(const uchar *key, uint8 key_type)
switch (key_type) {
case HA_KEYTYPE_INT8:
s_value= (longlong) *(const char*)key;
s_value= (longlong) *(const signed char*) key;
break;
case HA_KEYTYPE_BINARY:
value=(ulonglong) *key;
......
......@@ -553,7 +553,7 @@ ulonglong retrieve_auto_increment(MI_INFO *info,const uchar *record)
switch (keyseg->type) {
case HA_KEYTYPE_INT8:
s_value= (longlong) *(char*)key;
s_value= (longlong) *(const signed char*) key;
break;
case HA_KEYTYPE_BINARY:
value=(ulonglong) *(uchar*) key;
......
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