diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-04-13 10:26:01 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-04-13 10:26:01 +0300 |
commit | 6e6318b29b446f76f01f2ef65d1460870b607d2a (patch) | |
tree | 8c22bb7661b77c91b28532ddd7c150d4bf010146 /mysql-test/main/derived_opt.test | |
parent | 450c017c2d9e490d92c949d5164b4a99b6b3f5db (diff) | |
parent | e262eb165c197083df9f4986ab54c5b2dcbd6290 (diff) | |
download | mariadb-git-6e6318b29b446f76f01f2ef65d1460870b607d2a.tar.gz |
Merge 10.2 into 10.3
Diffstat (limited to 'mysql-test/main/derived_opt.test')
-rw-r--r-- | mysql-test/main/derived_opt.test | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/mysql-test/main/derived_opt.test b/mysql-test/main/derived_opt.test index eccf4c13020..dee424559ee 100644 --- a/mysql-test/main/derived_opt.test +++ b/mysql-test/main/derived_opt.test @@ -406,5 +406,38 @@ set optimizer_switch= @save_optimizer_switch; DROP TABLE t1,t2; +# +# MDEV-25182: Complex query in Store procedure corrupts results +# +set @save_optimizer_switch= @@optimizer_switch; +set optimizer_switch="derived_merge=on"; + +CREATE TABLE t1 (id int, d2 datetime, id1 int) ; +insert into t1 values (1,'2020-01-01 10:10:10',1),(2,'2020-01-01 10:10:10',2),(3,'2020-01-01 10:10:10',3); + +CREATE TABLE t2 (id int, d1 datetime, id1 int) ; +insert into t2 values (1,'2020-01-01 10:10:10',1),(2,'2020-01-01 10:10:10',2),(3,'2020-01-01 10:10:10',2); + +prepare stmt from " +SELECT * from + (SELECT min(d2) AS d2, min(d1) AS d1 FROM + (SELECT t1.d2 AS d2, (SELECT t2.d1 + FROM t2 WHERE t1.id1 = t2.id1 + ORDER BY t2.id DESC LIMIT 1) AS d1 + FROM t1 + ) dt2 + ) ca + ORDER BY ca.d2;"; + +execute stmt; +execute stmt; + +set optimizer_switch= @save_optimizer_switch; +DROP TABLE t1, t2; + +--echo # +--echo # End of 10.3 tests +--echo # + # The following command must be the last one the file set optimizer_switch=@exit_optimizer_switch; |