Skip to content

Commit

Permalink
Merge 10.2 into 10.3
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed May 24, 2021
2 parents b01a9fd + 5c75ba9 commit 1864a8e
Show file tree
Hide file tree
Showing 51 changed files with 1,511 additions and 307 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Expand Up @@ -110,11 +110,13 @@ FOREACH(_base
ENDIF()
ENDFOREACH()

IF(NOT RPM AND NOT DEB)
FOREACH(tool gtar tar)
STRING(TOUPPER ${tool} TOOL)
FIND_PROGRAM(${TOOL}_EXECUTABLE ${tool} DOC "path to the executable")
MARK_AS_ADVANCED(${TOOL}_EXECUTABLE)
ENDFOREACH()
ENDIF()

FIND_PACKAGE(Git)

Expand Down
13 changes: 13 additions & 0 deletions cmake/FindGit.cmake
@@ -0,0 +1,13 @@
if(GIT_EXECUTABLE)
set(GIT_FOUND TRUE)
return()
endif()
if(DEFINED GIT_EXECUTABLE)
set(GIT_FOUND FALSE)
return()
endif()

set(orig_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
unset(CMAKE_MODULE_PATH)
include(FindGit)
set(CMAKE_MODULE_PATH ${orig_CMAKE_MODULE_PATH})
5 changes: 5 additions & 0 deletions cmake/FindJNI.cmake
@@ -1,4 +1,9 @@
if(JAVA_AWT_LIBRARY)
set(JNI_FOUND TRUE)
return()
endif()
if(DEFINED JAVA_AWT_LIBRARY)
set(JNI_FOUND FALSE)
return()
endif()

Expand Down
5 changes: 5 additions & 0 deletions cmake/FindJava.cmake
@@ -1,4 +1,9 @@
if(Java_JAVA_EXECUTABLE)
set(JAVA_FOUND TRUE)
return()
endif()
if(DEFINED Java_JAVA_EXECUTABLE)
set(JAVA_FOUND FALSE)
return()
endif()

Expand Down
6 changes: 6 additions & 0 deletions cmake/build_configurations/mysql_release.cmake
Expand Up @@ -88,6 +88,12 @@ ENDIF()

SET(WITH_INNODB_SNAPPY OFF CACHE STRING "")
SET(WITH_NUMA 0 CACHE BOOL "")
SET(CPU_LEVEL1_DCACHE_LINESIZE 0)

IF(NOT EXISTS ${CMAKE_SOURCE_DIR}/.git)
SET(GIT_EXECUTABLE GIT_EXECUTABLE-NOTFOUND CACHE FILEPATH "")
ENDIF()

IF(WIN32)
SET(INSTALL_MYSQLTESTDIR "" CACHE STRING "")
SET(INSTALL_SQLBENCHDIR "" CACHE STRING "")
Expand Down
2 changes: 0 additions & 2 deletions cmake/cpack_rpm.cmake
Expand Up @@ -124,8 +124,6 @@ SET(ignored
"%ignore ${CMAKE_INSTALL_PREFIX}/share/man"
"%ignore ${CMAKE_INSTALL_PREFIX}/share/man/man1"
"%ignore ${CMAKE_INSTALL_PREFIX}/share/man/man8"
"%ignore ${CMAKE_INSTALL_PREFIX}/share/man/man1*"
"%ignore ${CMAKE_INSTALL_PREFIX}/share/man/man8*"
"%ignore ${CMAKE_INSTALL_PREFIX}/share/pkgconfig"
)

Expand Down
4 changes: 4 additions & 0 deletions cmake/cpu_info.cmake
Expand Up @@ -15,6 +15,8 @@

# Symbols with information about the CPU.

IF(NOT DEFINED CPU_LEVEL1_DCACHE_LINESIZE)

IF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
FIND_PROGRAM(SYSCTL sysctl)
MARK_AS_ADVANCED(SYSCTL)
Expand All @@ -37,3 +39,5 @@ ELSE()
)
ENDIF()
ENDIF()

ENDIF()
2 changes: 1 addition & 1 deletion dbug/CMakeLists.txt
Expand Up @@ -29,7 +29,7 @@ IF(NOT CMAKE_CROSSCOMPILING)
TARGET_LINK_LIBRARIES(factorial dbug)
ENDIF()

IF(NOT WIN32 AND NOT CMAKE_GENERATOR MATCHES Xcode)
IF(NOT WIN32 AND NOT CMAKE_GENERATOR MATCHES Xcode AND NOT RPM AND NOT DEB)
FIND_PROGRAM(GROFF groff)
FIND_PROGRAM(NROFF nroff)
MARK_AS_ADVANCED(GROFF)
Expand Down
4 changes: 4 additions & 0 deletions debian/mariadb-plugin-connect.install
@@ -1,2 +1,6 @@
etc/mysql/conf.d/connect.cnf etc/mysql/mariadb.conf.d
usr/lib/mysql/plugin/ha_connect.so
usr/share/mysql/Mongo2.jar
usr/share/mysql/Mongo3.jar
usr/share/mysql/JavaWrappers.jar
usr/share/mysql/JdbcInterface.jar
209 changes: 205 additions & 4 deletions mysql-test/main/cte_nonrecursive.result
Expand Up @@ -1120,10 +1120,10 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DERIVED t1 ALL NULL NULL NULL NULL 7 100.00 Using where
5 UNION t1 ALL NULL NULL NULL NULL 7 100.00 Using where
NULL UNION RESULT <union2,5> ALL NULL NULL NULL NULL NULL NULL
6 UNION <derived9> ALL NULL NULL NULL NULL 14 100.00
9 DERIVED t1 ALL NULL NULL NULL NULL 7 100.00 Using where
12 UNION t1 ALL NULL NULL NULL NULL 7 100.00 Using where
NULL UNION RESULT <union9,12> ALL NULL NULL NULL NULL NULL NULL
6 UNION <derived14> ALL NULL NULL NULL NULL 14 100.00
14 DERIVED t1 ALL NULL NULL NULL NULL 7 100.00 Using where
11 UNION t1 ALL NULL NULL NULL NULL 7 100.00 Using where
NULL UNION RESULT <union14,11> ALL NULL NULL NULL NULL NULL NULL
NULL UNION RESULT <union1,6> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1003 with cte_e as (with cte_o as (with cte_i as (/* select#4 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 7)/* select#3 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 1)/* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1 union /* select#5 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1)/* select#1 */ select `cte_e1`.`a` AS `a` from `cte_e` `cte_e1` where `cte_e1`.`a` > 1 union /* select#6 */ select `cte_e2`.`a` AS `a` from `cte_e` `cte_e2`
Expand Down Expand Up @@ -1763,6 +1763,207 @@ a c
2 1
7 3
drop table t1;
#
# MDEV-23886: Stored Function returning the result of a query
# that uses CTE over a table twice
#
create table t1 (c1 int);
insert into t1 values (1),(2),(6);
create function f1() returns int return
( with cte1 as (select c1 from t1)
select sum(c1) from
(select * from cte1 union all select * from cte1) dt
);
select f1();
f1()
18
create function f2() returns int return
( with cte1 as (select c1 from t1)
select sum(s.c1) from cte1 as s, cte1 as t where s.c1=t.c1
);
select f2();
f2()
9
create function f3() returns int return
( with cte1 as (select c1 from t1)
select
case
when exists(select 1 from cte1 where c1 between 1 and 2) then 1
when exists(select 1 from cte1 where c1 between 5 and 6) then 2
else 0
end
);
select f3();
f3()
1
create view v1 as (select c1 from t1);
create function f4() returns int return
( select sum(c1) from
(select * from v1 union all select * from v1) dt
);
select f4();
f4()
18
create function f5() returns int return
( select sum(s.c1) from v1 as s, v1 as t where s.c1=t.c1
);
select f5();
f5()
9
create view v2(s) as
with cte1 as (select c1 from t1)
select sum(c1) from (select * from cte1 union all select * from cte1) dt;
create function f6() returns int return
(select s from v2);
select f6();
f6()
18
create function f7() returns int return
( select r.s from v2 as r, v2 as t where r.s=t.s
);
select f7();
f7()
18
select f5() + f6();
f5() + f6()
27
prepare stmt from "select f5() + f6();";
execute stmt;
f5() + f6()
27
execute stmt;
f5() + f6()
27
deallocate prepare stmt;
drop function f1;
drop function f2;
drop function f3;
drop function f4;
drop function f5;
drop function f6;
drop function f7;
drop view v1;
drop view v2;
create table t2 (a int, b int);
insert into t2
with cte1 as (select c1 from t1)
select * from cte1 as s, cte1 as t where s.c1=t.c1 and s.c1 > 5;
select * from t2;
a b
6 6
create procedure p1()
begin
insert into t2
with cte1 as (select c1 from t1)
select * from cte1 as s, cte1 as t where s.c1=t.c1 and s.c1 <= 2 and t.c1 >= 2;
end |
call p1();
select * from t2;
a b
6 6
2 2
drop procedure p1;
# checking CTE resolution for queries with hanging CTEs
with
cte1(a) as (select * from t1 where c1 <= 2),
cte2(b) as (select * from cte1 where a >= 2),
cte3 as (select * from cte1,cte2 where cte1.a < cte2.b)
select * from cte3;
a b
1 2
select * from t2;
a b
6 6
2 2
with
cte1(a) as (select * from t1 where c1 <= 2),
cte2(b) as (select * from cte1 where a >= 2),
cte3 as (select * from cte1,cte2 where cte1.a < cte2.b)
select * from t2;
a b
6 6
2 2
with
cte1(a) as (select * from t1 where c1 <= 2),
cte2(b) as (select * from cte1 where c1 >= 2),
cte3 as (select * from cte1,cte2 where cte1.a < cte2.b)
select * from t2;
ERROR 42S22: Unknown column 'c1' in 'where clause'
with
cte1(a) as (select * from t1 where c1 <= 2),
cte2(b) as (select * from cte1 where a >= 2),
cte3 as (select * from cte1,cte2 where cte1.a < cte2.c1)
select * from t2;
ERROR 42S22: Unknown column 'cte2.c1' in 'where clause'
with
cte1 as (select * from t1 where c1 <= 2),
cte2(a,b) as (select * from cte1 as s1, cte1 as s2 where s1.c1=s2.c1)
select * from cte2;
a b
1 1
2 2
with
cte1 as (select * from t1 where c1 <= 2),
cte2(a,b) as (select * from cte1 as s1, cte1 as s2 where s1.c1=s2.c1)
select * from t2;
a b
6 6
2 2
with
cte1 as (select * from t1 where c1 <= 2),
cte2(a,b) as (select * from cte1 as s1, cte1 as s2 where s1.c1=c1)
select * from t2;
ERROR 23000: Column 'c1' in where clause is ambiguous
with cte3 as
( with cte2(a,b) as
( with cte1 as (select * from t1 where c1 <= 2)
select * from cte1 as s1, cte1 as s2 where s1.c1=s2.c1)
select r1.a,r2.b from cte2 as r1, cte2 as r2)
select * from cte3;
a b
1 1
2 1
1 2
2 2
with cte3 as
( with cte2(a,b) as
( with cte1 as (select * from t1 where c1 <= 2)
select * from cte1 as s1, cte1 as s2 where s1.c1=s2.c1)
select r1.a,r2.b from cte2 as r1, cte2 as r2)
select * from t2;
a b
6 6
2 2
with cte3 as
( with cte2(a,b) as
( with cte1 as (select * from t1 where c1 <= 2)
select * from cte1 as s1, cte1 as s2 where s1.c1=s2.c1)
select r1.c1,r2.c1 from cte2 as r1, cte2 as r2)
select * from t2;
ERROR 42S22: Unknown column 'r1.c1' in 'field list'
create procedure p1()
begin
insert into t2
with cte1 as (select c1 from t1)
select * from t1 as s, t1 as t where s.c1=t.c1 and s.c1 <= 2 and t.c1 >= 2;
end |
call p1();
select * from t2;
a b
6 6
2 2
2 2
drop procedure p1;
create procedure p1()
begin
insert into t2
with cte1 as (select a from t1)
select * from t1 as s, t1 as t where s.c1=t.c1 and s.c1 <= 2 and t.c1 >= 2;
end |
call p1();
ERROR 42S22: Unknown column 'a' in 'field list'
drop procedure p1;
drop table t1,t2;
# End of 10.2 tests
#
# MDEV-21673: several references to CTE that uses
Expand Down

0 comments on commit 1864a8e

Please sign in to comment.