List:Commits« Previous MessageNext Message »
From:Georgi Kodinov Date:February 25 2010 2:57pm
Subject:bzr commit into mysql-5.0-bugteam branch (joro:2844) Bug#49552
View as plain text  
#At file:///home/kgeorge/mysql/work/B49552-5.0-bugteam/ based on revid:joerg@stripped

 2844 Georgi Kodinov	2010-02-25
      Backport of the fix for bug #49552 to 5.0-bugteam

    modified:
      mysql-test/r/delete.result
      mysql-test/t/delete.test
      sql/sql_parse.cc
=== modified file 'mysql-test/r/delete.result'
--- a/mysql-test/r/delete.result	2007-12-04 10:32:11 +0000
+++ b/mysql-test/r/delete.result	2010-02-25 14:57:15 +0000
@@ -241,4 +241,16 @@ DELETE FROM t1 ORDER BY (f1(10)) LIMIT 1
 ERROR 42000: Incorrect number of arguments for FUNCTION test.f1; expected 0, got 1
 DROP TABLE t1;
 DROP FUNCTION f1;
+#
+# Bug #49552 : sql_buffer_result cause crash + not found records 
+#   in multitable delete/subquery
+#
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+SET SESSION SQL_BUFFER_RESULT=1;
+DELETE t1 FROM (SELECT SUM(a) a FROM t1) x,t1;
+SET SESSION SQL_BUFFER_RESULT=DEFAULT;
+SELECT * FROM t1;
+a
+DROP TABLE t1;
 End of 5.0 tests

=== modified file 'mysql-test/t/delete.test'
--- a/mysql-test/t/delete.test	2007-12-04 10:32:11 +0000
+++ b/mysql-test/t/delete.test	2010-02-25 14:57:15 +0000
@@ -247,4 +247,19 @@ DELETE FROM t1 ORDER BY (f1(10)) LIMIT 1
 DROP TABLE t1;
 DROP FUNCTION f1;
 
+
+--echo #
+--echo # Bug #49552 : sql_buffer_result cause crash + not found records 
+--echo #   in multitable delete/subquery
+--echo #
+
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+SET SESSION SQL_BUFFER_RESULT=1;
+DELETE t1 FROM (SELECT SUM(a) a FROM t1) x,t1;
+
+SET SESSION SQL_BUFFER_RESULT=DEFAULT;
+SELECT * FROM t1;
+DROP TABLE t1;
+
 --echo End of 5.0 tests

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2009-12-31 03:33:10 +0000
+++ b/sql/sql_parse.cc	2010-02-25 14:57:15 +0000
@@ -4009,9 +4009,9 @@ end_with_restore_list:
 			select_lex->where,
 			0, (ORDER *)NULL, (ORDER *)NULL, (Item *)NULL,
 			(ORDER *)NULL,
-			select_lex->options | thd->options |
+			(select_lex->options | thd->options |
 			SELECT_NO_JOIN_CACHE | SELECT_NO_UNLOCK |
-                        OPTION_SETUP_TABLES_DONE,
+                        OPTION_SETUP_TABLES_DONE) & ~OPTION_BUFFER_RESULT,
 			del_result, unit, select_lex);
       res|= thd->net.report_error;
       if (unlikely(res))


Attachment: [text/bzr-bundle] bzr/joro@sun.com-20100225145715-er2430j93w6fi43q.bundle
Thread
bzr commit into mysql-5.0-bugteam branch (joro:2844) Bug#49552Georgi Kodinov25 Feb