summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2016-12-19 22:03:28 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2017-10-13 12:35:17 +0200
commita4868c3509772da1666eb3d492515e7d39f8834d (patch)
treedcf4c1ab30383a0eef09c1cd86552de83b6a7f00 /mysql-test
parent991b9ee73597ba7287267207b3918e157e346899 (diff)
downloadmariadb-git-a4868c3509772da1666eb3d492515e7d39f8834d.tar.gz
MDEV-9208: Function->Function->View = Mysqld segfault (Server crashes in Dependency_marker::visit_field on 2nd execution with merged subquery)
Prevent crossing name resolution border in finding item tables.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/ps.result30
-rw-r--r--mysql-test/t/ps.test26
2 files changed, 56 insertions, 0 deletions
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index f954583a097..e2c0d6567ac 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -4173,4 +4173,34 @@ Warnings:
Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`c` AS `c` from `test`.`t1` where 0
deallocate prepare stmt2;
drop table t1;
+#
+# MDEV-9208: Function->Function->View = Mysqld segfault
+# (Server crashes in Dependency_marker::visit_field on 2nd
+# execution with merged subquery)
+#
+CREATE TABLE t1 (i1 INT);
+insert into t1 values(1),(2);
+CREATE TABLE t2 (i2 INT);
+insert into t2 values(1),(2);
+prepare stmt from "
+ select 1 from (
+ select
+ if (i1<0, 0, 0) as f1,
+ (select f1) as f2
+ from t1, t2
+ ) sq
+";
+execute stmt;
+1
+1
+1
+1
+1
+execute stmt;
+1
+1
+1
+1
+1
+drop table t1,t2;
# End of 5.5 tests
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index cfd810fd625..dac0bbd4d29 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -3714,4 +3714,30 @@ deallocate prepare stmt2;
drop table t1;
+--echo #
+--echo # MDEV-9208: Function->Function->View = Mysqld segfault
+--echo # (Server crashes in Dependency_marker::visit_field on 2nd
+--echo # execution with merged subquery)
+--echo #
+
+CREATE TABLE t1 (i1 INT);
+insert into t1 values(1),(2);
+
+CREATE TABLE t2 (i2 INT);
+insert into t2 values(1),(2);
+
+prepare stmt from "
+ select 1 from (
+ select
+ if (i1<0, 0, 0) as f1,
+ (select f1) as f2
+ from t1, t2
+ ) sq
+";
+
+execute stmt;
+execute stmt;
+
+drop table t1,t2;
+
--echo # End of 5.5 tests