Commit 225f0cd5 authored by Gopal Shankar's avatar Gopal Shankar

Merged from mysql-5.1-security

parents 166131c5 7f0f18cd
...@@ -111,4 +111,23 @@ DROP FUNCTION db1.f1; ...@@ -111,4 +111,23 @@ DROP FUNCTION db1.f1;
DROP TABLE db1.t1; DROP TABLE db1.t1;
DROP DATABASE db1; DROP DATABASE db1;
DROP DATABASE db2; DROP DATABASE db2;
#
# Bug#13105873:valgrind warning:possible crash in foreign
# key handling on subsequent create table if not exists
#
DROP DATABASE IF EXISTS testdb;
CREATE DATABASE testdb;
USE testdb;
CREATE TABLE t1 (id1 INT PRIMARY KEY);
CREATE PROCEDURE `p1`()
BEGIN
CREATE TABLE IF NOT EXISTS t2(id INT PRIMARY KEY,
CONSTRAINT FK FOREIGN KEY (id) REFERENCES t1( id1 ));
END$
CALL p1();
# below stmt should not return valgrind warnings
CALL p1();
Warnings:
Note 1050 Table 't2' already exists
DROP DATABASE testdb;
End of 5.1 tests End of 5.1 tests
...@@ -138,4 +138,28 @@ DROP FUNCTION db1.f1; ...@@ -138,4 +138,28 @@ DROP FUNCTION db1.f1;
DROP TABLE db1.t1; DROP TABLE db1.t1;
DROP DATABASE db1; DROP DATABASE db1;
DROP DATABASE db2; DROP DATABASE db2;
--echo #
--echo # Bug#13105873:valgrind warning:possible crash in foreign
--echo # key handling on subsequent create table if not exists
--echo #
--disable_warnings
DROP DATABASE IF EXISTS testdb;
--enable_warnings
CREATE DATABASE testdb;
USE testdb;
CREATE TABLE t1 (id1 INT PRIMARY KEY);
DELIMITER $;
CREATE PROCEDURE `p1`()
BEGIN
CREATE TABLE IF NOT EXISTS t2(id INT PRIMARY KEY,
CONSTRAINT FK FOREIGN KEY (id) REFERENCES t1( id1 ));
END$
DELIMITER ;$
CALL p1();
--echo # below stmt should not return valgrind warnings
CALL p1();
DROP DATABASE testdb;
--echo End of 5.1 tests --echo End of 5.1 tests
...@@ -138,9 +138,9 @@ Key::Key(const Key &rhs, MEM_ROOT *mem_root) ...@@ -138,9 +138,9 @@ Key::Key(const Key &rhs, MEM_ROOT *mem_root)
*/ */
Foreign_key::Foreign_key(const Foreign_key &rhs, MEM_ROOT *mem_root) Foreign_key::Foreign_key(const Foreign_key &rhs, MEM_ROOT *mem_root)
:Key(rhs), :Key(rhs,mem_root),
ref_table(rhs.ref_table), ref_table(rhs.ref_table),
ref_columns(rhs.ref_columns), ref_columns(rhs.ref_columns,mem_root),
delete_opt(rhs.delete_opt), delete_opt(rhs.delete_opt),
update_opt(rhs.update_opt), update_opt(rhs.update_opt),
match_opt(rhs.match_opt) match_opt(rhs.match_opt)
......
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