#At file:///mnt/raid/alik/MySQL/bzr/bug39255/6.0-rt-bug39255/
2729 Alexander Nozdrin 2008-10-16
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.
modified:
.bzrignore
mysql-test/r/sp.result
mysql-test/t/sp.test
per-file messages:
mysql-test/r/sp.result
Update test result file.
mysql-test/t/sp.test
Add a test case.
=== modified file '.bzrignore'
--- a/.bzrignore 2008-10-01 12:02:28 +0000
+++ b/.bzrignore 2008-10-16 12:39:30 +0000
@@ -1898,3 +1898,4 @@ mysql-test/tps.log
libmysqld/event_parse_data.cc
client/transaction.h
libmysqld/transaction.cc
+libmysqld/rpl_handler.cc
=== modified file 'mysql-test/r/sp.result'
--- a/mysql-test/r/sp.result 2008-09-25 11:46:17 +0000
+++ b/mysql-test/r/sp.result 2008-10-16 12:39:30 +0000
@@ -6948,3 +6948,21 @@ drop procedure p;
# ------------------------------------------------------------------
# -- End of 5.1 tests
# ------------------------------------------------------------------
+DROP FUNCTION IF EXISTS f1;
+DROP TABLE IF EXISTS t_non_existing;
+DROP TABLE IF EXISTS t1;
+CREATE FUNCTION f1() RETURNS INT
+BEGIN
+DECLARE v INT;
+SELECT a INTO v FROM t_non_existing;
+RETURN 1;
+END|
+CREATE TABLE t1 (a INT) ENGINE = myisam;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 WHERE a = f1();
+ERROR 42S02: Table 'test.t_non_existing' doesn't exist
+DROP FUNCTION f1;
+DROP TABLE t1;
+# ------------------------------------------------------------------
+# -- End of 6.0 tests
+# ------------------------------------------------------------------
=== modified file 'mysql-test/t/sp.test'
--- a/mysql-test/t/sp.test 2008-09-25 11:46:17 +0000
+++ b/mysql-test/t/sp.test 2008-10-16 12:39:30 +0000
@@ -8220,3 +8220,35 @@ drop procedure p;
--echo # ------------------------------------------------------------------
--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 # -- End of 6.0 tests
+--echo # ------------------------------------------------------------------
| Thread |
|---|
| • bzr commit into mysql-6.0 branch (alik:2729) Bug#39255 | Alexander Nozdrin | 18 Oct |