From 7117e0635c60f5db23ebb0f4b0866ce93b8ffaed Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Tue, 22 Mar 2011 14:48:56 +0300 Subject: A patch for Bug#11763413 (56115: SELECT doesn't work in prepared statements with cursor protocol). The problem was a bug in Materialized-cursor implementation. Materialized_cursor::open() called send_result_metadata() with items pointing to already closed table. The fix is to send metadata when the table is still open. NOTE: this is a "partial" fix: metadata are different with and without --cursor-protocol, but that's a different large problem, one indication of which is reported as Bug 24176. --- mysql-test/r/ps.result | 16 +++++++++++++++- mysql-test/t/ps.test | 16 +++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 17f639cdca3..afa105a39b8 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -3731,5 +3731,19 @@ CREATE TABLE t1 (a INT); BEGIN; PREPARE stmt1 FROM "SELECT * FROM t1"; DROP TABLE t1; + +# +# Bug#56115: invalid memory reads when PS selecting from +# information_schema tables +# Bug#58701: crash in Field::make_field, cursor-protocol +# +# NOTE: MTR should be run both with --ps-protocol and --cursor-protocol. +# + +SELECT * +FROM (SELECT 1 UNION SELECT 2) t; +1 +1 +2 # -# End of 6.0 tests. +# End of 5.5 tests. diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index eaef1cf3000..e00bd785789 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -3344,7 +3344,21 @@ connection default; DROP TABLE t1; disconnect con1; +--echo +--echo # +--echo # Bug#56115: invalid memory reads when PS selecting from +--echo # information_schema tables +--echo # Bug#58701: crash in Field::make_field, cursor-protocol +--echo # +--echo # NOTE: MTR should be run both with --ps-protocol and --cursor-protocol. +--echo # +--echo + +SELECT * +FROM (SELECT 1 UNION SELECT 2) t; + + --echo # ---echo # End of 6.0 tests. +--echo # End of 5.5 tests. ########################################################################### -- cgit v1.2.1