summaryrefslogtreecommitdiff
path: root/mysql-test/t/sp.test
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2018-08-30 15:18:35 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2018-08-30 16:56:46 +0200
commita69cb800d3a2001589dea6f2b189d4aeee661e60 (patch)
tree3c538e8bab966c1df5c469c7ca9c134cbe5aa527 /mysql-test/t/sp.test
parente560f2f342aeb2d72937e9c6f5a4fcbfecc1c35e (diff)
downloadmariadb-git-bb-5.5-MDEV-16957.tar.gz
MDEV-16957: Server crashes in Field_iterator_natural_join::next upon 2nd execution of SPbb-5.5-MDEV-16957
The problem was that join_columns creation was not finished due to error of notfound column in USING, but next execution tried to use join_columns lists. Solution is cleanup the lists on error. It can eat memory in statement MEM_ROOT but it is an error and error will be fixed or statement/procedure removed/altered.
Diffstat (limited to 'mysql-test/t/sp.test')
-rw-r--r--mysql-test/t/sp.test21
1 files changed, 21 insertions, 0 deletions
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 0e42bf3c831..cb93cd31442 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -9353,4 +9353,25 @@ where 1=1;
drop function if exists f1;
drop table t1,t2;
+--echo #
+--echo # MDEV-16957: Server crashes in Field_iterator_natural_join::next
+--echo # upon 2nd execution of SP
+--echo #
+
+CREATE TABLE t1 (a INT, b VARCHAR(32));
+CREATE PROCEDURE sp() SELECT * FROM t1 AS t1x JOIN t1 AS t1y USING (c);
+--error ER_BAD_FIELD_ERROR
+CALL sp;
+--error ER_BAD_FIELD_ERROR
+CALL sp;
+--error ER_BAD_FIELD_ERROR
+CALL sp;
+alter table t1 add column c int;
+CALL sp;
+
+# Cleanup
+DROP PROCEDURE sp;
+DROP TABLE t1;
+
+
--echo # End of 5.5 test