Skip to content

Commit 19644f6

Browse files
committed
Merge branch '10.5' into 10.6
2 parents 9b0294c + c461188 commit 19644f6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1313
-274
lines changed

cmake/cpack_rpm.cmake

+2-2
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ IF(WITH_WSREP)
230230
"galera-4" "rsync" "grep" "gawk" "iproute"
231231
"coreutils" "findutils" "tar")
232232
SETA(CPACK_RPM_server_PACKAGE_RECOMMENDS "lsof" "socat")
233-
SETA(CPACK_RPM_test_PACKAGE_REQUIRES "socat")
233+
SETA(CPACK_RPM_test_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}" "socat")
234234
ENDIF()
235235

236236
SET(CPACK_RPM_server_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-prein.sh)
@@ -277,7 +277,7 @@ ELSEIF(RPM MATCHES "fedora" OR RPM MATCHES "(rhel|centos)7")
277277
ALTERNATIVE_NAME("server" "mariadb-server")
278278
ALTERNATIVE_NAME("server" "mysql-compat-server")
279279
ALTERNATIVE_NAME("test" "mariadb-test")
280-
ELSEIF(RPM MATCHES "(rhel|centos|rocky)[89]")
280+
ELSEIF(RPM MATCHES "(rhel|centos|rocky)")
281281
SET(epoch 3:)
282282
ALTERNATIVE_NAME("backup" "mariadb-backup")
283283
ALTERNATIVE_NAME("client" "mariadb")

mysql-test/main/derived_cond_pushdown.result

+73-73
Original file line numberDiff line numberDiff line change
@@ -10247,55 +10247,44 @@ SELECT * FROM ( SELECT t1.f FROM v1 JOIN t1 ) AS t WHERE f IS NOT NULL;
1024710247
EXPLAIN INSERT INTO t1
1024810248
SELECT * FROM ( SELECT t1.f FROM v1 JOIN t1 ) AS t WHERE f IS NOT NULL;
1024910249
id select_type table type possible_keys key key_len ref rows Extra
10250-
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 144 Using where
10251-
2 DERIVED <derived4> ALL NULL NULL NULL NULL 12
10252-
2 DERIVED t1 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
10250+
1 PRIMARY <derived4> ALL NULL NULL NULL NULL 12 Using temporary
10251+
1 PRIMARY t1 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
1025310252
4 DERIVED t1 ALL NULL NULL NULL NULL 12
1025410253
EXPLAIN FORMAT=JSON INSERT INTO t1
1025510254
SELECT * FROM ( SELECT t1.f FROM v1 JOIN t1 ) AS t WHERE f IS NOT NULL;
1025610255
EXPLAIN
1025710256
{
1025810257
"query_block": {
1025910258
"select_id": 1,
10260-
"table": {
10261-
"table_name": "<derived2>",
10262-
"access_type": "ALL",
10263-
"rows": 144,
10264-
"filtered": 100,
10265-
"attached_condition": "t.f is not null",
10266-
"materialized": {
10267-
"query_block": {
10268-
"select_id": 2,
10269-
"table": {
10270-
"table_name": "<derived4>",
10271-
"access_type": "ALL",
10272-
"rows": 12,
10273-
"filtered": 100,
10274-
"materialized": {
10275-
"query_block": {
10276-
"select_id": 4,
10277-
"table": {
10278-
"table_name": "t1",
10279-
"access_type": "ALL",
10280-
"rows": 12,
10281-
"filtered": 100
10282-
}
10283-
}
10284-
}
10285-
},
10286-
"block-nl-join": {
10259+
"temporary_table": {
10260+
"table": {
10261+
"table_name": "<derived4>",
10262+
"access_type": "ALL",
10263+
"rows": 12,
10264+
"filtered": 100,
10265+
"materialized": {
10266+
"query_block": {
10267+
"select_id": 4,
1028710268
"table": {
1028810269
"table_name": "t1",
1028910270
"access_type": "ALL",
1029010271
"rows": 12,
10291-
"filtered": 100,
10292-
"attached_condition": "t1.f is not null"
10293-
},
10294-
"buffer_type": "flat",
10295-
"buffer_size": "64",
10296-
"join_type": "BNL"
10272+
"filtered": 100
10273+
}
1029710274
}
1029810275
}
10276+
},
10277+
"block-nl-join": {
10278+
"table": {
10279+
"table_name": "t1",
10280+
"access_type": "ALL",
10281+
"rows": 12,
10282+
"filtered": 100,
10283+
"attached_condition": "t1.f is not null"
10284+
},
10285+
"buffer_type": "flat",
10286+
"buffer_size": "64",
10287+
"join_type": "BNL"
1029910288
}
1030010289
}
1030110290
}
@@ -10326,43 +10315,33 @@ EXPLAIN
1032610315
{
1032710316
"query_block": {
1032810317
"select_id": 1,
10329-
"table": {
10330-
"table_name": "<derived2>",
10331-
"access_type": "ALL",
10332-
"rows": 16,
10333-
"filtered": 100,
10334-
"attached_condition": "t.f is not null",
10335-
"materialized": {
10336-
"query_block": {
10337-
"select_id": 2,
10338-
"table": {
10339-
"table_name": "t1",
10340-
"access_type": "ALL",
10341-
"rows": 8,
10342-
"filtered": 100,
10343-
"attached_condition": "t1.f is not null"
10344-
},
10345-
"table": {
10346-
"table_name": "<derived4>",
10347-
"access_type": "ref",
10348-
"possible_keys": ["key0"],
10349-
"key": "key0",
10350-
"key_length": "4",
10351-
"used_key_parts": ["f"],
10352-
"ref": ["test.t1.f"],
10353-
"rows": 2,
10354-
"filtered": 100,
10355-
"materialized": {
10356-
"query_block": {
10357-
"select_id": 4,
10358-
"table": {
10359-
"table_name": "t1",
10360-
"access_type": "ALL",
10361-
"rows": 8,
10362-
"filtered": 100,
10363-
"attached_condition": "t1.f is not null"
10364-
}
10365-
}
10318+
"temporary_table": {
10319+
"table": {
10320+
"table_name": "t1",
10321+
"access_type": "ALL",
10322+
"rows": 8,
10323+
"filtered": 100,
10324+
"attached_condition": "t1.f is not null"
10325+
},
10326+
"table": {
10327+
"table_name": "<derived4>",
10328+
"access_type": "ref",
10329+
"possible_keys": ["key0"],
10330+
"key": "key0",
10331+
"key_length": "4",
10332+
"used_key_parts": ["f"],
10333+
"ref": ["test.t1.f"],
10334+
"rows": 2,
10335+
"filtered": 100,
10336+
"materialized": {
10337+
"query_block": {
10338+
"select_id": 4,
10339+
"table": {
10340+
"table_name": "t1",
10341+
"access_type": "ALL",
10342+
"rows": 8,
10343+
"filtered": 100,
10344+
"attached_condition": "t1.f is not null"
1036610345
}
1036710346
}
1036810347
}
@@ -19134,4 +19113,25 @@ FROM cte2
1913419113
GROUP BY 1 ;
1913519114
( SELECT 1 FROM ( SELECT 1 FROM cte1) dt GROUP BY x HAVING x= 1 )
1913619115
1
19116+
create table t1 (f int);
19117+
create view v1 as select f, count(*) c from t1 group by f;
19118+
#
19119+
# MDEV-25012 Server crash in find_field_in_tables, Assertion `name' failed in find_field_in_table_ref
19120+
#
19121+
select * from v1 where export_set(1, default(f), 'x', aes_decrypt('secret', f));
19122+
f c
19123+
show warnings;
19124+
Level Code Message
19125+
drop view v1;
19126+
drop table t1;
19127+
create table t(c3 longtext) ;
19128+
with cte1 as
19129+
(
19130+
select default(c3) as a
19131+
from t group by 1
19132+
)
19133+
select * from cte1
19134+
where cte1.a >= 1;
19135+
a
19136+
drop table t;
1913719137
# End of 10.5 tests

mysql-test/main/derived_cond_pushdown.test

+22
Original file line numberDiff line numberDiff line change
@@ -4271,4 +4271,26 @@ SELECT
42714271
FROM cte2
42724272
GROUP BY 1 ;
42734273

4274+
create table t1 (f int);
4275+
create view v1 as select f, count(*) c from t1 group by f;
4276+
4277+
--echo #
4278+
--echo # MDEV-25012 Server crash in find_field_in_tables, Assertion `name' failed in find_field_in_table_ref
4279+
--echo #
4280+
select * from v1 where export_set(1, default(f), 'x', aes_decrypt('secret', f));
4281+
show warnings;
4282+
# cleanup
4283+
drop view v1;
4284+
drop table t1;
4285+
4286+
create table t(c3 longtext) ;
4287+
with cte1 as
4288+
(
4289+
select default(c3) as a
4290+
from t group by 1
4291+
)
4292+
select * from cte1
4293+
where cte1.a >= 1;
4294+
drop table t;
4295+
42744296
--echo # End of 10.5 tests

mysql-test/main/derived_view.result

+2
Original file line numberDiff line numberDiff line change
@@ -2385,6 +2385,8 @@ SELECT * FROM t1;
23852385
a
23862386
1
23872387
1
2388+
1
2389+
1
23882390
drop table t1,t2;
23892391
set optimizer_switch=@save968720_optimizer_switch;
23902392
#

mysql-test/main/insert.result

+71-1
Original file line numberDiff line numberDiff line change
@@ -806,5 +806,75 @@ a
806806
8
807807
drop table t1;
808808
#
809-
# End of 10.5 tests
809+
# MDEV-32086 Server crash when inserting from derived table containing insert target table
810+
# (part 2)
810811
#
812+
create table t1 (pk int, id int);
813+
insert into t1 values (2,2), (3,3), (4,4);
814+
select * from t1;
815+
pk id
816+
2 2
817+
3 3
818+
4 4
819+
select 101+count(*)
820+
from
821+
(
822+
select dt2.id
823+
from (select id from t1) dt2, t1 t where t.id=dt2.id
824+
) dt
825+
where dt.id<1000;
826+
101+count(*)
827+
104
828+
prepare s from '
829+
insert into t1 values(
830+
(select 101+count(*)
831+
from
832+
(
833+
select dt2.id
834+
from (select id from t1) dt2, t1 t where t.id=dt2.id
835+
) dt
836+
where dt.id<1000
837+
), 123
838+
)
839+
';
840+
execute s;
841+
select * from t1;
842+
pk id
843+
2 2
844+
3 3
845+
4 4
846+
104 123
847+
select 101+count(*)
848+
from
849+
(
850+
select dt2.id
851+
from (select id from t1) dt2, t1 t where t.id=dt2.id
852+
) dt
853+
where dt.id<1000;
854+
101+count(*)
855+
105
856+
execute s;
857+
select * from t1;
858+
pk id
859+
2 2
860+
3 3
861+
4 4
862+
104 123
863+
105 123
864+
drop table t1;
865+
#
866+
# Try this: INSERT INTO t1 VALUES ... reference to t1
867+
# RETURNING (subquery not touching t1)
868+
create table t1 (a int, b int);
869+
create table t2 (a int, b int);
870+
# This is accepted:
871+
insert into t1 (a) values
872+
(3),
873+
((select max(a) from t1))
874+
returning
875+
a, b, (select max(a) from t2);
876+
a b (select max(a) from t2)
877+
3 NULL NULL
878+
NULL NULL NULL
879+
drop table t1,t2;
880+
# End of 10.5 tests

mysql-test/main/insert.test

+55-1
Original file line numberDiff line numberDiff line change
@@ -675,5 +675,59 @@ select * from t1;
675675
drop table t1;
676676

677677
--echo #
678-
--echo # End of 10.5 tests
678+
--echo # MDEV-32086 Server crash when inserting from derived table containing insert target table
679+
--echo # (part 2)
679680
--echo #
681+
682+
create table t1 (pk int, id int);
683+
insert into t1 values (2,2), (3,3), (4,4);
684+
select * from t1;
685+
select 101+count(*)
686+
from
687+
(
688+
select dt2.id
689+
from (select id from t1) dt2, t1 t where t.id=dt2.id
690+
) dt
691+
where dt.id<1000;
692+
prepare s from '
693+
insert into t1 values(
694+
(select 101+count(*)
695+
from
696+
(
697+
select dt2.id
698+
from (select id from t1) dt2, t1 t where t.id=dt2.id
699+
) dt
700+
where dt.id<1000
701+
), 123
702+
)
703+
';
704+
execute s;
705+
select * from t1;
706+
select 101+count(*)
707+
from
708+
(
709+
select dt2.id
710+
from (select id from t1) dt2, t1 t where t.id=dt2.id
711+
) dt
712+
where dt.id<1000;
713+
execute s;
714+
select * from t1;
715+
716+
drop table t1;
717+
718+
--echo #
719+
--echo # Try this: INSERT INTO t1 VALUES ... reference to t1
720+
--echo # RETURNING (subquery not touching t1)
721+
create table t1 (a int, b int);
722+
create table t2 (a int, b int);
723+
724+
--echo # This is accepted:
725+
insert into t1 (a) values
726+
(3),
727+
((select max(a) from t1))
728+
returning
729+
a, b, (select max(a) from t2);
730+
731+
drop table t1,t2;
732+
733+
--echo # End of 10.5 tests

mysql-test/main/insert_returning.result

+2
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,8 @@ t1 WHERE id1=1)
498498
5 6
499499
INSERT INTO t2(id2,val2) VALUES(5,'f') RETURNING (SELECT id2 FROM t2);
500500
ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as a separate source for data
501+
INSERT INTO t2(id2,val2) VALUES(5,'f') RETURNING (SELECT 1 UNION SELECT id2 FROM t2);
502+
ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as a separate source for data
501503
INSERT INTO t2 (id2, val2) VALUES (6,'f') RETURNING t1.*;
502504
ERROR 42S02: Unknown table 'test.t1'
503505
#

mysql-test/main/insert_returning.test

+2
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ INSERT INTO t2(id2,val2) VALUES(5,'e') RETURNING id2, (SELECT id1+id2 FROM
199199
t1 WHERE id1=1);
200200
--error ER_UPDATE_TABLE_USED
201201
INSERT INTO t2(id2,val2) VALUES(5,'f') RETURNING (SELECT id2 FROM t2);
202+
--error ER_UPDATE_TABLE_USED
203+
INSERT INTO t2(id2,val2) VALUES(5,'f') RETURNING (SELECT 1 UNION SELECT id2 FROM t2);
202204
--error ER_BAD_TABLE_ERROR
203205
INSERT INTO t2 (id2, val2) VALUES (6,'f') RETURNING t1.*;
204206

0 commit comments

Comments
 (0)