summaryrefslogtreecommitdiff
path: root/mysql-test/t/sp.test
diff options
context:
space:
mode:
authorAlexander Nozdrin <alik@sun.com>2009-10-15 21:08:41 +0400
committerAlexander Nozdrin <alik@sun.com>2009-10-15 21:08:41 +0400
commit424f1ff2e053e380fa7985a20f88c9764cc2b76b (patch)
tree2eda5db999d4b6fce89d19bde07810e958bee9e2 /mysql-test/t/sp.test
parent847d38573fe752f6cf6113746b8d0505581da9de (diff)
downloadmariadb-git-424f1ff2e053e380fa7985a20f88c9764cc2b76b.tar.gz
A backporting patch for the following revision from 6.0:
revno: 2630.22.41 committer: Alexander Nozdrin <alik@mysql.com> branch nick: 6.0-rt-bug39255 timestamp: Thu 2008-10-16 16:39:30 +0400 message: A patch for Bug#39255: Stored procedures: crash if function references nonexistent table. The problem is not reproduced in 6.0. Adding a test case.
Diffstat (limited to 'mysql-test/t/sp.test')
-rw-r--r--mysql-test/t/sp.test28
1 files changed, 28 insertions, 0 deletions
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index a560076e89f..d82abab6f17 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -8268,6 +8268,34 @@ DROP TABLE t1, t2;
--echo # -- End of 5.1 tests
--echo # ------------------------------------------------------------------
+#
+# Bug#39255: Stored procedures: crash if function references nonexistent table
+#
+
+--disable_warnings
+DROP FUNCTION IF EXISTS f1;
+DROP TABLE IF EXISTS t_non_existing;
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+delimiter |;
+CREATE FUNCTION f1() RETURNS INT
+BEGIN
+ DECLARE v INT;
+ SELECT a INTO v FROM t_non_existing;
+ RETURN 1;
+END|
+delimiter ;|
+
+CREATE TABLE t1 (a INT) ENGINE = myisam;
+INSERT INTO t1 VALUES (1);
+
+--error ER_NO_SUCH_TABLE
+SELECT * FROM t1 WHERE a = f1();
+
+DROP FUNCTION f1;
+DROP TABLE t1;
+
--echo #
--echo # Bug#34197: CREATE PROCEDURE fails when COMMENT truncated in non
--echo # strict SQL mode