summaryrefslogtreecommitdiff
path: root/mysql-test/main/derived.result
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2022-01-29 15:41:05 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2022-01-29 15:41:05 +0100
commit41a163ac5ccf4ac5394edc84e40b3f47acea6b08 (patch)
tree60d5259e290b4a0166d8ef1651975b14b5afe304 /mysql-test/main/derived.result
parenta85d942be9008cf19086d8bd330c4be83a18167f (diff)
parente2b50213cf12623da31c8b49be4d40772876223c (diff)
downloadmariadb-git-41a163ac5ccf4ac5394edc84e40b3f47acea6b08.tar.gz
Merge branch '10.2' into 10.3mariadb-10.3.33
Diffstat (limited to 'mysql-test/main/derived.result')
-rw-r--r--mysql-test/main/derived.result53
1 files changed, 53 insertions, 0 deletions
diff --git a/mysql-test/main/derived.result b/mysql-test/main/derived.result
index 0f917509e20..c3421a288a1 100644
--- a/mysql-test/main/derived.result
+++ b/mysql-test/main/derived.result
@@ -1204,6 +1204,59 @@ REPLACE INTO v2 ( SELECT * FROM v4 ) UNION ( SELECT f FROM v2 );
drop view v1,v2,v3,v4;
drop table t1,t2,t3;
#
+# MDEV-20325: Assertion `outer_context || !*from_field || *from_field == not_found_field' failed in Item_field::fix_outer_field | `!derived->is_excluded()' failed in TABLE_LIST::set_check_materialized | SIGEGV in st_select_lex::mark_as_dependent (optimized builds)
+#
+CREATE TABLE t1 (a INT);
+# Check that re-execution of a stored routine containing
+# a query with subquery in the FROM clause doesn't result in
+# assert failure in case the 'derived_merge' optimizer option
+# has been turned on/off
+CREATE PROCEDURE sp() SELECT * FROM (SELECT a FROM t1) tb;
+CALL sp();
+a
+SET optimizer_switch='derived_merge=off';
+# Without the patch the following statement would result in assert
+# failure
+CALL sp();
+a
+# Check the same test case for Prepared Statement
+SET optimizer_switch='derived_merge=on';
+PREPARE stmt FROM "SELECT * FROM (SELECT a FROM t1) tb";
+EXECUTE stmt;
+a
+SET optimizer_switch='derived_merge=off';
+# Without the patch the following statement would result in assert
+# failure
+EXECUTE stmt;
+a
+DEALLOCATE PREPARE stmt;
+# Here check the reverse test case - first turn off the 'derived_merge'
+# optimizer option, run the stored routine containing a query with
+# subquery in the FROM clause, then turn on the 'derived_merge'
+# optimizer option and re-execute the same stored routine to check that
+# the routine is finished successfully.
+CREATE PROCEDURE sp1() SELECT * FROM (SELECT a FROM t1) tb;
+SET optimizer_switch='derived_merge=off';
+CALL sp1();
+a
+SET optimizer_switch='derived_merge=on';
+CALL sp1();
+a
+# Check the same test case for Prepared Statement
+SET optimizer_switch='derived_merge=off';
+PREPARE stmt FROM "SELECT * FROM (SELECT a FROM t1) tb";
+EXECUTE stmt;
+a
+SET optimizer_switch='derived_merge=on';
+# Without the patch the following statement would result in assert
+# failure
+EXECUTE stmt;
+a
+DEALLOCATE PREPARE stmt;
+DROP PROCEDURE sp;
+DROP PROCEDURE sp1;
+DROP TABLE t1;
+#
# End of 10.2 tests
#
#