Skip to content

Commit eebe209

Browse files
committed
Merge 10.3 -> 10.4
2 parents a1e2ca0 + 4a6e2d3 commit eebe209

26 files changed

+741
-19
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,9 @@ compile_commands.json
557557
# Clion && other JetBrains ides
558558
.idea
559559

560+
.cache/clangd
561+
562+
560563
client/mariadb
561564
client/mariadb-admin
562565
client/mariadb-binlog

cmake/cpack_rpm.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,11 @@ SET(ignored
127127
"%ignore ${CMAKE_INSTALL_PREFIX}/share/pkgconfig"
128128
)
129129

130-
SET(CPACK_RPM_server_USER_FILELIST ${ignored} "%config(noreplace) ${INSTALL_SYSCONF2DIR}/*")
130+
SET(CPACK_RPM_server_USER_FILELIST
131+
${ignored}
132+
"%config(noreplace) ${INSTALL_SYSCONF2DIR}/*"
133+
"%config(noreplace) ${INSTALL_SYSCONFDIR}/logrotate.d/mysql"
134+
)
131135
SET(CPACK_RPM_common_USER_FILELIST ${ignored} "%config(noreplace) ${INSTALL_SYSCONFDIR}/my.cnf")
132136
SET(CPACK_RPM_shared_USER_FILELIST ${ignored} "%config(noreplace) ${INSTALL_SYSCONF2DIR}/*")
133137
SET(CPACK_RPM_client_USER_FILELIST ${ignored} "%config(noreplace) ${INSTALL_SYSCONF2DIR}/*")

mysql-test/main/cte_nonrecursive.result

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1964,6 +1964,61 @@ call p1();
19641964
ERROR 42S22: Unknown column 'a' in 'field list'
19651965
drop procedure p1;
19661966
drop table t1,t2;
1967+
#
1968+
# MDEV-20411: SP containing only one SELECT with WITH clause
1969+
#
1970+
create procedure sp1 ()
1971+
with cte as (select 1 as a) select * from cte;
1972+
call sp1();
1973+
a
1974+
1
1975+
call sp1();
1976+
a
1977+
1
1978+
create table t1 (a int);
1979+
insert into t1 values (3), (7), (1), (7), (1), (1), (3), (1), (5);
1980+
create procedure sp2 ()
1981+
with cte as (select * from t1) select * from cte;
1982+
call sp2();
1983+
a
1984+
3
1985+
7
1986+
1
1987+
7
1988+
1
1989+
1
1990+
3
1991+
1
1992+
5
1993+
call sp2();
1994+
a
1995+
3
1996+
7
1997+
1
1998+
7
1999+
1
2000+
1
2001+
3
2002+
1
2003+
5
2004+
create procedure sp3 ()
2005+
with cte as (select * from t1 group by a) select * from cte;
2006+
call sp3();
2007+
a
2008+
1
2009+
3
2010+
5
2011+
7
2012+
call sp3();
2013+
a
2014+
1
2015+
3
2016+
5
2017+
7
2018+
drop procedure sp1;
2019+
drop procedure sp2;
2020+
drop procedure sp3;
2021+
drop table t1;
19672022
# End of 10.2 tests
19682023
#
19692024
# MDEV-21673: several references to CTE that uses

mysql-test/main/cte_nonrecursive.test

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,6 +1463,35 @@ drop procedure p1;
14631463

14641464
drop table t1,t2;
14651465

1466+
1467+
--echo #
1468+
--echo # MDEV-20411: SP containing only one SELECT with WITH clause
1469+
--echo #
1470+
1471+
create procedure sp1 ()
1472+
with cte as (select 1 as a) select * from cte;
1473+
call sp1();
1474+
call sp1();
1475+
1476+
create table t1 (a int);
1477+
insert into t1 values (3), (7), (1), (7), (1), (1), (3), (1), (5);
1478+
1479+
create procedure sp2 ()
1480+
with cte as (select * from t1) select * from cte;
1481+
call sp2();
1482+
call sp2();
1483+
1484+
create procedure sp3 ()
1485+
with cte as (select * from t1 group by a) select * from cte;
1486+
call sp3();
1487+
call sp3();
1488+
1489+
drop procedure sp1;
1490+
drop procedure sp2;
1491+
drop procedure sp3;
1492+
1493+
drop table t1;
1494+
14661495
--echo # End of 10.2 tests
14671496

14681497
--echo #

mysql-test/main/derived_cond_pushdown.result

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10670,6 +10670,153 @@ Warnings:
1067010670
Note 1003 /* select#1 */ select `v2`.`a` AS `a`,`v2`.`f` AS `f`,`v2`.`g` AS `g` from `test`.`v2` where `v2`.`a` = `v2`.`f` and `v2`.`a` = `v2`.`g`
1067110671
drop view v1,v2;
1067210672
drop table t1;
10673+
#
10674+
# MDEV-25969: Condition pushdown into derived table doesn't work if select list uses SP
10675+
#
10676+
create function f1(a int) returns int DETERMINISTIC return (a+1);
10677+
create table t1 (
10678+
pk int primary key,
10679+
a int,
10680+
b int,
10681+
key(a)
10682+
);
10683+
create table t2(a int);
10684+
insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
10685+
create table t3(a int);
10686+
insert into t3 select A.a + B.a* 10 + C.a * 100 from t2 A, t2 B, t2 C;
10687+
insert into t1 select a,a,a from t3;
10688+
create view v1 as
10689+
select
10690+
t1.a as col1,
10691+
f1(t1.b) as col2
10692+
from
10693+
t1;
10694+
create view v2 as
10695+
select
10696+
t1.a as col1,
10697+
f1(t1.b) as col2
10698+
from
10699+
t1;
10700+
create view v3 as
10701+
select col2, col1 from v1
10702+
union all
10703+
select col2, col1 from v2;
10704+
explain select * from v3 where col1=123;
10705+
id select_type table type possible_keys key key_len ref rows Extra
10706+
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using where
10707+
2 DERIVED t1 ref a a 5 const 1
10708+
3 UNION t1 ref a a 5 const 1
10709+
# This must use ref accesses for reading table t1, not full scans:
10710+
explain format=json
10711+
select * from v3 where col1=123 and col2=321;
10712+
EXPLAIN
10713+
{
10714+
"query_block": {
10715+
"select_id": 1,
10716+
"table": {
10717+
"table_name": "<derived2>",
10718+
"access_type": "ALL",
10719+
"rows": 2,
10720+
"filtered": 100,
10721+
"attached_condition": "v3.col1 = 123 and v3.col2 = 321",
10722+
"materialized": {
10723+
"query_block": {
10724+
"union_result": {
10725+
"table_name": "<union2,3>",
10726+
"access_type": "ALL",
10727+
"query_specifications": [
10728+
{
10729+
"query_block": {
10730+
"select_id": 2,
10731+
"table": {
10732+
"table_name": "t1",
10733+
"access_type": "ref",
10734+
"possible_keys": ["a"],
10735+
"key": "a",
10736+
"key_length": "5",
10737+
"used_key_parts": ["a"],
10738+
"ref": ["const"],
10739+
"rows": 1,
10740+
"filtered": 100
10741+
}
10742+
}
10743+
},
10744+
{
10745+
"query_block": {
10746+
"select_id": 3,
10747+
"operation": "UNION",
10748+
"table": {
10749+
"table_name": "t1",
10750+
"access_type": "ref",
10751+
"possible_keys": ["a"],
10752+
"key": "a",
10753+
"key_length": "5",
10754+
"used_key_parts": ["a"],
10755+
"ref": ["const"],
10756+
"rows": 1,
10757+
"filtered": 100
10758+
}
10759+
}
10760+
}
10761+
]
10762+
}
10763+
}
10764+
}
10765+
}
10766+
}
10767+
}
10768+
drop function f1;
10769+
drop view v1,v2,v3;
10770+
drop table t1, t2,t3;
10771+
#
10772+
# Another testcase, with pushdown through GROUP BY
10773+
#
10774+
create table t1 (a int, b int);
10775+
insert into t1 values (1,1),(2,2),(3,3);
10776+
create function f1(a int) returns int DETERMINISTIC return (a+1);
10777+
create view v2(a, a2, s) as
10778+
select a, f1(a), sum(b) from t1 group by a, f1(a);
10779+
# Here,
10780+
# "(s+1) > 10" will be pushed into HAVING
10781+
# "a > 1" will be pushed all the way to the table scan on t1
10782+
# "a2>123" will be pushed into HAVING (as it refers to an SP call which
10783+
# prevents pushing it to the WHERE)
10784+
explain format=json
10785+
select * from v2 where (s+1) > 10 AND a > 1 and a2>123;
10786+
EXPLAIN
10787+
{
10788+
"query_block": {
10789+
"select_id": 1,
10790+
"table": {
10791+
"table_name": "<derived2>",
10792+
"access_type": "ALL",
10793+
"rows": 3,
10794+
"filtered": 100,
10795+
"attached_condition": "v2.s + 1 > 10 and v2.a > 1 and v2.a2 > 123",
10796+
"materialized": {
10797+
"query_block": {
10798+
"select_id": 2,
10799+
"having_condition": "s + 1 > 10 and a2 > 123",
10800+
"filesort": {
10801+
"sort_key": "t1.a, f1(t1.a)",
10802+
"temporary_table": {
10803+
"table": {
10804+
"table_name": "t1",
10805+
"access_type": "ALL",
10806+
"rows": 3,
10807+
"filtered": 100,
10808+
"attached_condition": "t1.a > 1"
10809+
}
10810+
}
10811+
}
10812+
}
10813+
}
10814+
}
10815+
}
10816+
}
10817+
drop view v2;
10818+
drop function f1;
10819+
drop table t1;
1067310820
# End of 10.2 tests
1067410821
#
1067510822
# MDEV-14579: pushdown conditions into materialized views/derived tables

mysql-test/main/derived_cond_pushdown.test

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2238,6 +2238,76 @@ eval explain extended $q2;
22382238
drop view v1,v2;
22392239
drop table t1;
22402240

2241+
--echo #
2242+
--echo # MDEV-25969: Condition pushdown into derived table doesn't work if select list uses SP
2243+
--echo #
2244+
create function f1(a int) returns int DETERMINISTIC return (a+1);
2245+
2246+
create table t1 (
2247+
pk int primary key,
2248+
a int,
2249+
b int,
2250+
key(a)
2251+
);
2252+
2253+
create table t2(a int);
2254+
insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
2255+
2256+
create table t3(a int);
2257+
insert into t3 select A.a + B.a* 10 + C.a * 100 from t2 A, t2 B, t2 C;
2258+
2259+
insert into t1 select a,a,a from t3;
2260+
2261+
create view v1 as
2262+
select
2263+
t1.a as col1,
2264+
f1(t1.b) as col2
2265+
from
2266+
t1;
2267+
2268+
create view v2 as
2269+
select
2270+
t1.a as col1,
2271+
f1(t1.b) as col2
2272+
from
2273+
t1;
2274+
create view v3 as
2275+
select col2, col1 from v1
2276+
union all
2277+
select col2, col1 from v2;
2278+
2279+
explain select * from v3 where col1=123;
2280+
2281+
--echo # This must use ref accesses for reading table t1, not full scans:
2282+
explain format=json
2283+
select * from v3 where col1=123 and col2=321;
2284+
2285+
drop function f1;
2286+
drop view v1,v2,v3;
2287+
drop table t1, t2,t3;
2288+
2289+
--echo #
2290+
--echo # Another testcase, with pushdown through GROUP BY
2291+
--echo #
2292+
create table t1 (a int, b int);
2293+
insert into t1 values (1,1),(2,2),(3,3);
2294+
2295+
create function f1(a int) returns int DETERMINISTIC return (a+1);
2296+
2297+
create view v2(a, a2, s) as
2298+
select a, f1(a), sum(b) from t1 group by a, f1(a);
2299+
2300+
--echo # Here,
2301+
--echo # "(s+1) > 10" will be pushed into HAVING
2302+
--echo # "a > 1" will be pushed all the way to the table scan on t1
2303+
--echo # "a2>123" will be pushed into HAVING (as it refers to an SP call which
2304+
--echo # prevents pushing it to the WHERE)
2305+
explain format=json
2306+
select * from v2 where (s+1) > 10 AND a > 1 and a2>123;
2307+
2308+
drop view v2;
2309+
drop function f1;
2310+
drop table t1;
22412311
--echo # End of 10.2 tests
22422312

22432313
--echo #

mysql-test/main/gis-json.result

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,16 @@ Warning 4076 Incorrect GeoJSON format - empty 'coordinates' array.
107107
SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"Feature\", \"geometry\": [10, 20] }");
108108
ST_GEOMFROMGEOJSON("{ \"type\": \"Feature\", \"geometry\": [10, 20] }")
109109
NULL
110+
SELECT ST_ASTEXT (ST_GEOMFROMGEOJSON ('{ "type": "GEOMETRYCOLLECTION", "coordinates": [102.0, 0.0]}'));
111+
ST_ASTEXT (ST_GEOMFROMGEOJSON ('{ "type": "GEOMETRYCOLLECTION", "coordinates": [102.0, 0.0]}'))
112+
NULL
113+
Warnings:
114+
Warning 4048 Incorrect GeoJSON format specified for st_geomfromgeojson function.
115+
SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON('{"type": ["POINT"], "coINates": [0,0] }'));
116+
ST_ASTEXT(ST_GEOMFROMGEOJSON('{"type": ["POINT"], "coINates": [0,0] }'))
117+
NULL
118+
Warnings:
119+
Warning 4048 Incorrect GeoJSON format specified for st_geomfromgeojson function.
110120
#
111121
# End of 10.2 tests
112122
#

mysql-test/main/gis-json.test

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ SELECT st_astext(st_geomfromgeojson('{"type": "MultiPolygon","coordinates": []}'
4646

4747
SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"Feature\", \"geometry\": [10, 20] }");
4848

49+
#
50+
# MDEV-25461 Assertion `je->state == JST_KEY' failed in Geometry::create_from_json.
51+
#
52+
53+
SELECT ST_ASTEXT (ST_GEOMFROMGEOJSON ('{ "type": "GEOMETRYCOLLECTION", "coordinates": [102.0, 0.0]}'));
54+
55+
SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON('{"type": ["POINT"], "coINates": [0,0] }'));
4956
--echo #
5057
--echo # End of 10.2 tests
5158
--echo #

mysql-test/main/information_schema.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ GEOMETRY_COLUMNS
6565
GLOBAL_STATUS
6666
GLOBAL_VARIABLES
6767
INDEX_STATISTICS
68+
KEYWORDS
6869
KEY_CACHES
6970
KEY_COLUMN_USAGE
7071
OPTIMIZER_TRACE
@@ -80,6 +81,7 @@ SCHEMA_PRIVILEGES
8081
SESSION_STATUS
8182
SESSION_VARIABLES
8283
SPATIAL_REF_SYS
84+
SQL_FUNCTIONS
8385
STATISTICS
8486
SYSTEM_VARIABLES
8587
TABLES

0 commit comments

Comments
 (0)