Skip to content

Commit

Permalink
Merge branch '10.2' into 10.3
Browse files Browse the repository at this point in the history
  • Loading branch information
sanja-byelkin committed Nov 15, 2018
2 parents 13cd4cf + f74649b commit 49a91a6
Show file tree
Hide file tree
Showing 37 changed files with 764 additions and 21 deletions.
2 changes: 1 addition & 1 deletion libmariadb
11 changes: 11 additions & 0 deletions mysql-test/main/bigint.result
Original file line number Diff line number Diff line change
Expand Up @@ -510,3 +510,14 @@ DROP TABLE t1;
SELECT 100 BETWEEN 1 AND 9223372036854775808;
100 BETWEEN 1 AND 9223372036854775808
1
#
# MDEV-17724 Wrong result for BETWEEN 0 AND 18446744073709551615
#
CREATE TABLE t1 (c1 bigint(20) unsigned NOT NULL);
INSERT INTO t1 VALUES (0),(101),(255);
SELECT * FROM t1 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1;
c1
0
101
255
DROP TABLE t1;
9 changes: 9 additions & 0 deletions mysql-test/main/bigint.test
Original file line number Diff line number Diff line change
Expand Up @@ -416,3 +416,12 @@ DROP TABLE t1;
--echo # MDEV-9372 select 100 between 1 and 9223372036854775808 returns false
--echo #
SELECT 100 BETWEEN 1 AND 9223372036854775808;

--echo #
--echo # MDEV-17724 Wrong result for BETWEEN 0 AND 18446744073709551615
--echo #

CREATE TABLE t1 (c1 bigint(20) unsigned NOT NULL);
INSERT INTO t1 VALUES (0),(101),(255);
SELECT * FROM t1 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1;
DROP TABLE t1;
93 changes: 93 additions & 0 deletions mysql-test/main/derived_cond_pushdown.result
Original file line number Diff line number Diff line change
Expand Up @@ -10403,6 +10403,99 @@ f
3
DROP VIEW v1;
DROP TABLE t1;
#
# MDEV-17574: pushdown into derived from mergeable view
# used in multi-table UPDATE
# pushdown into materialized derived from mergeable view
# used in SELECT
#
CREATE TABLE t1 (f1 text, f2 int);
INSERT INTO t1 VALUES ('x',1), ('y',2);
CREATE VIEW v1 AS SELECT f2 FROM ( SELECT f2 FROM t1 ) AS t;
UPDATE v1, t1 SET t1.f1 = 'z' WHERE v1.f2 < 2 AND t1.f2 = v1.f2;
EXPLAIN FORMAT=JSON UPDATE v1, t1 SET t1.f1 = 'z' WHERE v1.f2 < 2 AND t1.f2 = v1.f2;
EXPLAIN
{
"query_block": {
"select_id": 1,
"table": {
"table_name": "<derived3>",
"access_type": "ALL",
"rows": 2,
"filtered": 100,
"attached_condition": "t.f2 < 2",
"materialized": {
"query_block": {
"select_id": 3,
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 2,
"filtered": 100,
"attached_condition": "t1.f2 < 2"
}
}
}
},
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 2,
"filtered": 100,
"attached_condition": "t1.f2 = t.f2"
}
}
}
SELECT * FROM t1;
f1 f2
z 1
y 2
CREATE VIEW v2 AS SELECT f2 FROM ( SELECT DISTINCT f2 FROM t1 ) AS t;
SELECT * FROM v2, t1 WHERE v2.f2 < 2 AND t1.f2 = v2.f2;
f2 f1 f2
1 z 1
EXPLAIN FORMAT=JSON SELECT * FROM v2, t1 WHERE v2.f2 < 2 AND t1.f2 = v2.f2;
EXPLAIN
{
"query_block": {
"select_id": 1,
"table": {
"table_name": "<derived3>",
"access_type": "ALL",
"rows": 2,
"filtered": 100,
"attached_condition": "t.f2 < 2",
"materialized": {
"query_block": {
"select_id": 3,
"temporary_table": {
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 2,
"filtered": 100,
"attached_condition": "t1.f2 < 2"
}
}
}
}
},
"block-nl-join": {
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 2,
"filtered": 100
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"join_type": "BNL",
"attached_condition": "t1.f2 = t.f2"
}
}
}
DROP VIEW v1,v2;
DROP TABLE t1;
# End of 10.2 tests
#
# MDEV-14579: pushdown conditions into materialized views/derived tables
Expand Down
27 changes: 27 additions & 0 deletions mysql-test/main/derived_cond_pushdown.test
Original file line number Diff line number Diff line change
Expand Up @@ -2075,6 +2075,33 @@ SELECT * FROM t1;
DROP VIEW v1;
DROP TABLE t1;

--echo #
--echo # MDEV-17574: pushdown into derived from mergeable view
--echo # used in multi-table UPDATE
--echo # pushdown into materialized derived from mergeable view
--echo # used in SELECT
--echo #

CREATE TABLE t1 (f1 text, f2 int);
INSERT INTO t1 VALUES ('x',1), ('y',2);

CREATE VIEW v1 AS SELECT f2 FROM ( SELECT f2 FROM t1 ) AS t;
let $q1 =
UPDATE v1, t1 SET t1.f1 = 'z' WHERE v1.f2 < 2 AND t1.f2 = v1.f2;
eval $q1;
eval EXPLAIN FORMAT=JSON $q1;

SELECT * FROM t1;

CREATE VIEW v2 AS SELECT f2 FROM ( SELECT DISTINCT f2 FROM t1 ) AS t;
let $q2 =
SELECT * FROM v2, t1 WHERE v2.f2 < 2 AND t1.f2 = v2.f2;
eval $q2;
eval EXPLAIN FORMAT=JSON $q2;

DROP VIEW v1,v2;
DROP TABLE t1;

--echo # End of 10.2 tests

--echo #
Expand Down
20 changes: 20 additions & 0 deletions mysql-test/main/distinct.result
Original file line number Diff line number Diff line change
Expand Up @@ -1049,4 +1049,24 @@ b1+'0' b2+'0' b3+'0' b4+'0' b5+'0' b6 +'0'
1 0 0 1 0 1
0 1 0 0 1 0
DROP TABLE t1;
#
# MDEV-12575: Server crash in AGGR_OP::put_record or in JOIN_CACHE::free
# or Invalid write in JOIN::make_aggr_tables_info
#
CREATE TABLE t1 (pk INT PRIMARY KEY);
INSERT INTO t1 VALUES (1),(2);
explain
( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) )
UNION
( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) );
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL PRIMARY 4 NULL 2 Using index; Using temporary
2 UNION t1 index NULL PRIMARY 4 NULL 2 Using index; Using temporary
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) )
UNION
( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) );
1
1
drop table t1;
End of 5.5 tests
18 changes: 18 additions & 0 deletions mysql-test/main/distinct.test
Original file line number Diff line number Diff line change
Expand Up @@ -798,4 +798,22 @@ CREATE TABLE t1 (b1 BIT, b2 BIT, b3 BIT, b4 BIT , b5 BIT, b6 BIT);
INSERT INTO t1 VALUES (1,0,0,1,0,1),(0,1,0,0,1,0);
SELECT DISTINCT b1+'0', b2+'0', b3+'0', b4+'0', b5+'0', b6 +'0' FROM t1;
DROP TABLE t1;

--echo #
--echo # MDEV-12575: Server crash in AGGR_OP::put_record or in JOIN_CACHE::free
--echo # or Invalid write in JOIN::make_aggr_tables_info
--echo #

CREATE TABLE t1 (pk INT PRIMARY KEY);
INSERT INTO t1 VALUES (1),(2);
explain
( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) )
UNION
( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) );

( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) )
UNION
( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) );
drop table t1;

--echo End of 5.5 tests
10 changes: 9 additions & 1 deletion mysql-test/main/func_default.result
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,21 @@ explain extended select default(str), default(strnull), default(intg), default(r
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
Note 1003 select default('') AS `default(str)`,default('') AS `default(strnull)`,default(0) AS `default(intg)`,default(0) AS `default(rel)` from dual
Note 1003 select default(`test`.`t1`.`str`) AS `default(str)`,default(`test`.`t1`.`strnull`) AS `default(strnull)`,default(`test`.`t1`.`intg`) AS `default(intg)`,default(`test`.`t1`.`rel`) AS `default(rel)` from dual
select * from t1 where str <> default(str);
str strnull intg rel
0 0
explain select * from t1 where str <> default(str);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
create view v1 as select default(str), default(strnull), default(intg), default(rel) from t1;
select * from v1;
default(str) default(strnull) default(intg) default(rel)
def NULL 10 3.14
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select default(`t1`.`str`) AS `default(str)`,default(`t1`.`strnull`) AS `default(strnull)`,default(`t1`.`intg`) AS `default(intg)`,default(`t1`.`rel`) AS `default(rel)` from `t1` latin1 latin1_swedish_ci
drop view v1;
drop table t1;
CREATE TABLE t1 (id int(11), s varchar(20));
INSERT INTO t1 VALUES (1, 'one'), (2, 'two'), (3, 'three');
Expand Down
5 changes: 5 additions & 0 deletions mysql-test/main/func_default.test
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ explain extended select default(str), default(strnull), default(intg), default(r
select * from t1 where str <> default(str);
explain select * from t1 where str <> default(str);

create view v1 as select default(str), default(strnull), default(intg), default(rel) from t1;
select * from v1;
show create view v1;
drop view v1;

#TODO: uncomment when bug will be fixed
#create table t2 select default(str), default(strnull), default(intg), default(rel) from t1;
#show create table from t1;
Expand Down
20 changes: 20 additions & 0 deletions mysql-test/main/func_json.result
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,26 @@ SELECT JSON_MERGE('[1]', '[]');
JSON_MERGE('[1]', '[]')
[1]
#
# MDEV-16174 Assertion `0' failed in Type_handler_string_result::
# make_sort_key(uchar*, Item*, const SORT_FIELD_ATTR*, Sort_param*)
#
SET sql_mode='';
CREATE TABLE t1 (fld varchar(16) NOT NULL);
CREATE TABLE t2 SELECT JSON_ARRAY_INSERT(fld, '$.[0]', '0') FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`JSON_ARRAY_INSERT(fld, '$.[0]', '0')` varchar(25) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1, t2;
SET sql_mode=default;
#
# MDEV-17454 JSON_VALID( '{"a":1]' ) evaluates to 1
#
select JSON_VALID( '{"a":1]' );
JSON_VALID( '{"a":1]' )
0
#
# End of 10.2 tests
#
#
Expand Down
19 changes: 19 additions & 0 deletions mysql-test/main/func_json.test
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,25 @@ SET @`json` := NULL, @`value` := NULL;

SELECT JSON_MERGE('[1]', '[]');

--echo #
--echo # MDEV-16174 Assertion `0' failed in Type_handler_string_result::
--echo # make_sort_key(uchar*, Item*, const SORT_FIELD_ATTR*, Sort_param*)
--echo #

SET sql_mode='';
CREATE TABLE t1 (fld varchar(16) NOT NULL);
CREATE TABLE t2 SELECT JSON_ARRAY_INSERT(fld, '$.[0]', '0') FROM t1;
SHOW CREATE TABLE t2;
DROP TABLE t1, t2;
SET sql_mode=default;

--echo #
--echo # MDEV-17454 JSON_VALID( '{"a":1]' ) evaluates to 1
--echo #

select JSON_VALID( '{"a":1]' );


--echo #
--echo # End of 10.2 tests
--echo #
Expand Down
57 changes: 57 additions & 0 deletions mysql-test/main/func_time.result
Original file line number Diff line number Diff line change
Expand Up @@ -3424,6 +3424,63 @@ DROP TABLE t1,t2;
# End of 10.1 tests
#
#
# MDEV-16217: Assertion `!table || (!table->read_set ||
# bitmap_is_set(table->read_set, field_index))'
# failed in Field_num::get_date
#
CREATE TABLE t1 (pk int default 0, a1 date);
INSERT INTO t1 VALUES (1,'1900-01-01'),(2,NULL),(3,NULL),(4,NULL);
CREATE VIEW v1 AS
SELECT t1.pk AS pk, t1.a1 AS a1 FROM t1;
SELECT a1 BETWEEN (('2018-08-24')) AND (DEFAULT(pk)) FROM v1;
a1 BETWEEN (('2018-08-24')) AND (DEFAULT(pk))
0
NULL
NULL
NULL
SELECT a1 BETWEEN (('2018-08-24')) AND (~ DEFAULT(pk)) FROM v1;
a1 BETWEEN (('2018-08-24')) AND (~ DEFAULT(pk))
0
NULL
NULL
NULL
Warnings:
Warning 1292 Incorrect datetime value: '18446744073709551615'
CREATE TABLE t2 (pk int default 1, a1 date);
INSERT INTO t2 VALUES (4,NULL);
CREATE view v2 as SELECT default(t1.pk), default(t2.pk), t1.pk from t1,t2;
select * from v2;
default(t1.pk) default(t2.pk) pk
0 1 1
0 1 2
0 1 3
0 1 4
show create view v2;
View Create View character_set_client collation_connection
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select default(`t1`.`pk`) AS `default(t1.pk)`,default(`t2`.`pk`) AS `default(t2.pk)`,`t1`.`pk` AS `pk` from (`t1` join `t2`) latin1 latin1_swedish_ci
CREATE view v3 as SELECT default(pk) from t2;
select * from v3;
default(pk)
1
explain extended select * from v3;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00
Warnings:
Note 1003 select default(`test`.`t2`.`pk`) AS `default(pk)` from dual
explain extended select default(pk) from t2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00
Warnings:
Note 1003 select default(`test`.`t2`.`pk`) AS `default(pk)` from dual
show create view v3;
View Create View character_set_client collation_connection
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select default(`t2`.`pk`) AS `default(pk)` from `t2` latin1 latin1_swedish_ci
DROP VIEW v1,v2,v3;
DROP TABLE t1,t2;
#
# End of 10.2 tests
#
#
# Start of 10.3 tests
#
#
Expand Down
Loading

0 comments on commit 49a91a6

Please sign in to comment.