Commit b534a7b8 authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

Merge branch '10.3' into bb-10.3-fix_len_dec

parents 083279f7 956b2962
...@@ -2977,5 +2977,45 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -2977,5 +2977,45 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings: Warnings:
Note 1003 /* select#1 */ select straight_join `test`.`t1`.`c1` AS `c1` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`c1`,<exists>(/* select#3 */ select `test`.`t2`.`c2` from `test`.`t2` where <cache>(`test`.`t1`.`c1`) = `test`.`t2`.`c2`)) Note 1003 /* select#1 */ select straight_join `test`.`t1`.`c1` AS `c1` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`c1`,<exists>(/* select#3 */ select `test`.`t2`.`c2` from `test`.`t2` where <cache>(`test`.`t1`.`c1`) = `test`.`t2`.`c2`))
DROP TABLE t1, t2; DROP TABLE t1, t2;
#
# Bug mdev-16420: materialized view that renames columns
# in inner part of outer join
#
CREATE TABLE t1 (id int, PRIMARY KEY (id));
INSERT INTO t1 VALUES (2), (3), (7), (1);
CREATE VIEW v1 AS SELECT * FROM t1;
CREATE VIEW v2 AS SELECT v1.id AS order_pk FROM v1 GROUP BY v1.id;
CREATE VIEW v3 AS
SELECT t.id AS order_pk FROM (SELECT * FROM t1) AS t GROUP BY t.id;
SELECT * FROM t1 LEFT JOIN v2 ON t1.id=v2.order_pk;
id order_pk
1 1
2 2
3 3
7 7
EXPLAIN EXTENDED
SELECT * FROM t1 LEFT JOIN v2 ON t1.id=v2.order_pk;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
1 PRIMARY <derived2> ref key0 key0 5 test.t1.id 2 100.00
2 DERIVED t1 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index; Using filesort
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`v2`.`order_pk` AS `order_pk` from `test`.`t1` left join `test`.`v2` on(`v2`.`order_pk` = `test`.`t1`.`id`) where 1
SELECT * FROM t1 LEFT JOIN v3 ON t1.id=v3.order_pk;
id order_pk
1 1
2 2
3 3
7 7
EXPLAIN EXTENDED
SELECT * FROM t1 LEFT JOIN v3 ON t1.id=v3.order_pk;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
1 PRIMARY <derived2> ref key0 key0 5 test.t1.id 2 100.00
2 DERIVED t1 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index; Using filesort
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`v3`.`order_pk` AS `order_pk` from `test`.`t1` left join `test`.`v3` on(`v3`.`order_pk` = `test`.`t1`.`id`) where 1
DROP VIEW v1,v2,v3;
DROP TABLE t1;
set optimizer_switch=@exit_optimizer_switch; set optimizer_switch=@exit_optimizer_switch;
set join_cache_level=@exit_join_cache_level; set join_cache_level=@exit_join_cache_level;
...@@ -1949,6 +1949,30 @@ eval EXPLAIN EXTENDED $q; ...@@ -1949,6 +1949,30 @@ eval EXPLAIN EXTENDED $q;
DROP TABLE t1, t2; DROP TABLE t1, t2;
--echo #
--echo # Bug mdev-16420: materialized view that renames columns
--echo # in inner part of outer join
--echo #
CREATE TABLE t1 (id int, PRIMARY KEY (id));
INSERT INTO t1 VALUES (2), (3), (7), (1);
CREATE VIEW v1 AS SELECT * FROM t1;
CREATE VIEW v2 AS SELECT v1.id AS order_pk FROM v1 GROUP BY v1.id;
CREATE VIEW v3 AS
SELECT t.id AS order_pk FROM (SELECT * FROM t1) AS t GROUP BY t.id;
SELECT * FROM t1 LEFT JOIN v2 ON t1.id=v2.order_pk;
EXPLAIN EXTENDED
SELECT * FROM t1 LEFT JOIN v2 ON t1.id=v2.order_pk;
SELECT * FROM t1 LEFT JOIN v3 ON t1.id=v3.order_pk;
EXPLAIN EXTENDED
SELECT * FROM t1 LEFT JOIN v3 ON t1.id=v3.order_pk;
DROP VIEW v1,v2,v3;
DROP TABLE t1;
# The following command must be the last one the file # The following command must be the last one the file
set optimizer_switch=@exit_optimizer_switch; set optimizer_switch=@exit_optimizer_switch;
set join_cache_level=@exit_join_cache_level; set join_cache_level=@exit_join_cache_level;
...@@ -16814,7 +16814,10 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, ...@@ -16814,7 +16814,10 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
if (result && modify_item) if (result && modify_item)
field->result_field= result; field->result_field= result;
if (orig_item) if (orig_item)
{
item->maybe_null= save_maybe_null; item->maybe_null= save_maybe_null;
result->field_name= orig_item->name;
}
} }
else if (table_cant_handle_bit_fields && field->field->type() == else if (table_cant_handle_bit_fields && field->field->type() ==
MYSQL_TYPE_BIT) MYSQL_TYPE_BIT)
......
...@@ -214,6 +214,37 @@ id ...@@ -214,6 +214,37 @@ id
10000 10000
connection master_1; connection master_1;
Crash from b4a2baffa82e5c07b96a1c752228560dcac1359b (MDEV-11084)
Fixed with 4968049799193394d442f26b4e3a8d95b185be72
Spider crashed if the first partition was not used first
connection master_1;
CREATE TABLE ta_l2 (
a INT,
b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1
INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
Query a Spider table only using the second partition
SELECT a,b,c FROM ta_l2 PARTITION (pt2);
a b c
4 d 2003-11-30 05:01:03
5 c 2001-12-31 23:59:59
Query a Spider table only using the first partition
SELECT a,b,c FROM ta_l2 PARTITION (pt1);
a b c
1 a 2008-08-01 10:21:39
2 b 2000-01-01 00:00:00
3 e 2007-06-04 20:03:11
Query a Spider table by all paritions, then the second partition
SELECT min(a), max(a), min(b), max(b) FROM ta_l2;
min(a) max(a) min(b) max(b)
1 5 a e
SELECT a,b,c FROM ta_l2 PARTITION (pt2);
a b c
4 d 2003-11-30 05:01:03
5 c 2001-12-31 23:59:59
deinit deinit
connection master_1; connection master_1;
DROP DATABASE IF EXISTS auto_test_local; DROP DATABASE IF EXISTS auto_test_local;
......
...@@ -616,6 +616,115 @@ if ($HAVE_PARTITION) ...@@ -616,6 +616,115 @@ if ($HAVE_PARTITION)
} }
} }
--echo
--echo Crash from b4a2baffa82e5c07b96a1c752228560dcac1359b (MDEV-11084)
--echo Fixed with 4968049799193394d442f26b4e3a8d95b185be72
--echo Spider crashed if the first partition was not used first
if ($HAVE_PARTITION)
{
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_2
if ($OUTPUT_CHILD_GROUP2)
{
--disable_query_log
echo CHILD2_2_DROP_TABLES;
echo CHILD2_2_CREATE_TABLES;
}
--disable_warnings
eval $CHILD2_2_DROP_TABLES;
--enable_warnings
eval $CHILD2_2_CREATE_TABLES;
if ($OUTPUT_CHILD_GROUP2)
{
--enable_query_log
}
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
--connection child2_1
if ($OUTPUT_CHILD_GROUP2)
{
--disable_query_log
echo CHILD2_1_DROP_TABLES2;
echo CHILD2_1_CREATE_TABLES2;
}
--disable_warnings
eval $CHILD2_1_DROP_TABLES2;
--enable_warnings
eval $CHILD2_1_CREATE_TABLES2;
if ($OUTPUT_CHILD_GROUP2)
{
--enable_query_log
}
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--connection master_1
--disable_query_log
--disable_warnings
DROP TABLE IF EXISTS ta_l2;
--enable_warnings
echo CREATE TABLE ta_l2 (
a INT,
b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
eval CREATE TABLE ta_l2 (
a INT,
b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1;
--enable_query_log
INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
--echo Query a Spider table only using the second partition
SELECT a,b,c FROM ta_l2 PARTITION (pt2);
--echo Query a Spider table only using the first partition
SELECT a,b,c FROM ta_l2 PARTITION (pt1);
--echo Query a Spider table by all paritions, then the second partition
SELECT min(a), max(a), min(b), max(b) FROM ta_l2;
SELECT a,b,c FROM ta_l2 PARTITION (pt2);
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_2
if ($USE_GENERAL_LOG)
{
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
}
eval $CHILD2_2_SELECT_TABLES;
--connection child2_1
if ($USE_GENERAL_LOG)
{
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
}
eval $CHILD2_1_SELECT_TABLES2;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
}
--echo --echo
--echo deinit --echo deinit
......
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