#At file:///home/kgeorge/mysql/work/B49552-5.1-bugteam/ based on revid:svoj@stripped
3333 Georgi Kodinov 2010-01-22
Bug #49552 : sql_buffer_result cause crash + not found records
in multitable delete/subquery
SQL_BUFFER_RESULT should not have an effect on non-SELECT
statements according to our documentation.
Fixed by not passing it through to multi-table DELETE (similarly
to how it's done for multi-table UPDATE).
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 2009-11-18 09:32:03 +0000
+++ b/mysql-test/r/delete.result 2010-01-22 13:58:05 +0000
@@ -337,3 +337,14 @@ END |
DELETE IGNORE FROM t1;
ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
DROP TABLE t1;
+#
+# 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;
+DROP TABLE t1;
+End of 5.1 tests
=== modified file 'mysql-test/t/delete.test'
--- a/mysql-test/t/delete.test 2009-11-18 09:32:03 +0000
+++ b/mysql-test/t/delete.test 2010-01-22 13:58:05 +0000
@@ -357,4 +357,20 @@ END |
--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
DELETE IGNORE FROM t1;
-DROP TABLE t1;
\ No newline at end of file
+DROP TABLE t1;
+
+
+--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;
+DROP TABLE t1;
+
+--echo End of 5.1 tests
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc 2010-01-22 10:58:21 +0000
+++ b/sql/sql_parse.cc 2010-01-22 13:58:05 +0000
@@ -3352,9 +3352,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->is_error();
if (res)
Attachment: [text/bzr-bundle] bzr/joro@sun.com-20100122135805-wjuv4zlw1oojba0i.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-bugteam branch (joro:3333) Bug#49552 | Georgi Kodinov | 22 Jan |