Commit adc8d5ee authored by Alexander Nozdrin's avatar Alexander Nozdrin

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.
parent eed8c7ab
...@@ -3065,3 +3065,4 @@ sql/share/swedish ...@@ -3065,3 +3065,4 @@ sql/share/swedish
sql/share/ukrainian sql/share/ukrainian
libmysqld/examples/mysqltest.cc libmysqld/examples/mysqltest.cc
libmysqld/sql_signal.cc libmysqld/sql_signal.cc
libmysqld/rpl_handler.cc
...@@ -6933,6 +6933,21 @@ DROP TABLE t1, t2; ...@@ -6933,6 +6933,21 @@ DROP TABLE t1, t2;
# ------------------------------------------------------------------ # ------------------------------------------------------------------
# -- End of 5.1 tests # -- 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;
# #
# Bug#34197: CREATE PROCEDURE fails when COMMENT truncated in non # Bug#34197: CREATE PROCEDURE fails when COMMENT truncated in non
# strict SQL mode # strict SQL mode
......
...@@ -8268,6 +8268,34 @@ DROP TABLE t1, t2; ...@@ -8268,6 +8268,34 @@ DROP TABLE t1, t2;
--echo # -- End of 5.1 tests --echo # -- End of 5.1 tests
--echo # ------------------------------------------------------------------ --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 #
--echo # Bug#34197: CREATE PROCEDURE fails when COMMENT truncated in non --echo # Bug#34197: CREATE PROCEDURE fails when COMMENT truncated in non
--echo # strict SQL mode --echo # strict SQL mode
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment