* Alexey Botchkov <holyfoot@stripped> [08/08/07 20:39]:
I fixed this bug differently in 6.0.
Please use this patch, I verified that it fixes the problem:
2681 Konstantin Osipov 2008-07-17
Fix a pushbuild crash and a valgrind warning introduced by the previous
changeset for WL#3288.
modified:
sql/sp_head.cc
2680 Konstantin Osipov 2008-07-16
Code cleanup.
modified:
sql/item_subselect.cc
sql/sql_select.cc
=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc 2008-06-28 11:00:59 +0000
+++ b/sql/sp_head.cc 2008-07-17 09:15:22 +0000
@@ -1933,7 +1933,15 @@ sp_head::execute_procedure(THD *thd, Lis
we'll leave it here.
*/
if (!thd->in_sub_stmt)
+ {
+ thd->lex->unit.cleanup();
+
+ thd_proc_info(thd, "closing tables");
close_thread_tables(thd);
+ thd_proc_info(thd, 0);
+
+ thd->rollback_item_tree_changes();
+ }
DBUG_PRINT("info",(" %.*s: eval args done",
(int) m_name.length, m_name.str));
> === modified file 'mysql-test/r/sp-error.result'
> --- a/mysql-test/r/sp-error.result 2008-01-23 20:26:41 +0000
> +++ b/mysql-test/r/sp-error.result 2008-08-07 14:57:54 +0000
> @@ -1513,3 +1513,10 @@ end loop label1;
> end loop;
> end|
> ERROR 42000: End-label label1 without match
> +CREATE TABLE t1 (a INT)|
> +INSERT INTO t1 VALUES (1),(2)|
> +CREATE PROCEDURE p1(a INT) BEGIN END|
> +CALL p1((SELECT * FROM t1))|
> +ERROR 21000: Subquery returns more than 1 row
> +DROP PROCEDURE p1|
> +DROP TABLE t1|
please add drop procedure p1 if exists.
>
> === modified file 'sql/item_subselect.cc'
> --- a/sql/item_subselect.cc 2008-03-28 11:31:52 +0000
> +++ b/sql/item_subselect.cc 2008-08-07 14:57:54 +0000
> @@ -1874,6 +1874,7 @@ int subselect_single_select_engine::exec
> }
>
> join->exec();
> + join->cleanup(FALSE);
This means JOIN::cleanup will be called twice. Yes, an extra semi-cleanup
(FALSE passed as argument) is harmless now, but you break the life-cycle
-- e.g. if in future we won't be able to rely that cleanup is not called an
extra time.
--