Skip to content

Commit

Permalink
An additional test for MDEV-12347 Valgrind reports invalid read error…
Browse files Browse the repository at this point in the history
…s in Item_field_row::element_index_by_name
  • Loading branch information
Alexander Barkov committed Apr 5, 2017
1 parent 01457ec commit 891c1e2
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
35 changes: 35 additions & 0 deletions mysql-test/suite/compat/oracle/r/sp-row.result
Expand Up @@ -2954,3 +2954,38 @@ rec1.a rec1.b
10 b10
DROP TABLE t1;
DROP PROCEDURE p1;
#
# MDEV-12347 Valgrind reports invalid read errors in Item_field_row::element_index_by_name
#
CREATE TABLE t1 (a INT, b ENUM('b0','b1','b12','b3'));
CREATE PROCEDURE p1 AS
BEGIN
DECLARE
rec t1%ROWTYPE;
BEGIN
rec.b:='b0';
SELECT rec.b;
END;
END;
$$
CALL p1();
rec.b
b0
DROP TABLE t1;
DROP PROCEDURE p1;
CREATE TABLE t1 (a INT, b SET('b0','b1','b12','b3'));
CREATE PROCEDURE p1 AS
BEGIN
DECLARE
rec t1%ROWTYPE;
BEGIN
rec.b:='b0';
SELECT rec.b;
END;
END;
$$
CALL p1();
rec.b
b0
DROP TABLE t1;
DROP PROCEDURE p1;
46 changes: 46 additions & 0 deletions mysql-test/suite/compat/oracle/t/sp-row.test
Expand Up @@ -2242,3 +2242,49 @@ DELIMITER ;$$
CALL p1();
DROP TABLE t1;
DROP PROCEDURE p1;


--echo #
--echo # MDEV-12347 Valgrind reports invalid read errors in Item_field_row::element_index_by_name
--echo #

# An additional test for MDEV-12347, to make sure that
# Column_definition::interval creates a permanent copy of TYPELIB on
# the memory root when processing %ROWTYPE for a table with ENUM/SET column,
# rather than reuses the TYPELIB from table->field[i], which is freed in the
# end of sp_rcontext::resolve_table_rowtype_ref().

CREATE TABLE t1 (a INT, b ENUM('b0','b1','b12','b3'));
DELIMITER $$;
CREATE PROCEDURE p1 AS
BEGIN
DECLARE
rec t1%ROWTYPE;
BEGIN
rec.b:='b0';
SELECT rec.b;
END;
END;
$$
DELIMITER ;$$
CALL p1();
DROP TABLE t1;
DROP PROCEDURE p1;


CREATE TABLE t1 (a INT, b SET('b0','b1','b12','b3'));
DELIMITER $$;
CREATE PROCEDURE p1 AS
BEGIN
DECLARE
rec t1%ROWTYPE;
BEGIN
rec.b:='b0';
SELECT rec.b;
END;
END;
$$
DELIMITER ;$$
CALL p1();
DROP TABLE t1;
DROP PROCEDURE p1;

0 comments on commit 891c1e2

Please sign in to comment.