[Commits] Rev 3675: Fixed bug mdev-4918. in file:///home/igor/maria/maria-10.0-base/

Igor Babaev igor at askmonty.org
Sun Aug 18 22:29:06 EEST 2013


At file:///home/igor/maria/maria-10.0-base/

------------------------------------------------------------
revno: 3675
revision-id: igor at askmonty.org-20130818192906-39spjhz7xqi88jqz
parent: knielsen at knielsen-hq.org-20130816131025-etjrvmfvupsjzq83
committer: Igor Babaev <igor at askmonty.org>
branch nick: maria-10.0-base
timestamp: Sun 2013-08-18 12:29:06 -0700
message:
  Fixed bug mdev-4918.
  The function SELECT_LEX::mark_const_derived() must take into account that
  in DELETE ... RETURNING join == NULL.
-------------- next part --------------
=== modified file 'mysql-test/r/delete_returning.result'
--- a/mysql-test/r/delete_returning.result	2013-08-06 20:31:38 +0000
+++ b/mysql-test/r/delete_returning.result	2013-08-18 19:29:06 +0000
@@ -233,3 +233,13 @@
 DROP VIEW v1;
 DROP TABLE t1,t2;
 DROP TABLE t1c,t2c;
+#
+# Bug mdev-4918: DELETE ... RETURNING subquery with more than 1 row
+#
+CREATE TABLE t1 (i1 int);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (i2 int);
+INSERT INTO t2 VALUES (1),(2);
+DELETE FROM t1 ORDER BY i1 RETURNING ( SELECT i2 FROM t2 );
+ERROR 21000: Subquery returns more than 1 row
+DROP TABLE t1,t2;

=== modified file 'mysql-test/t/delete_returning.test'
--- a/mysql-test/t/delete_returning.test	2013-08-06 20:31:38 +0000
+++ b/mysql-test/t/delete_returning.test	2013-08-18 19:29:06 +0000
@@ -186,4 +186,17 @@
 DROP TABLE t1,t2;
 DROP TABLE t1c,t2c;
 
-
+--echo #
+--echo # Bug mdev-4918: DELETE ... RETURNING subquery with more than 1 row
+--echo #
+
+CREATE TABLE t1 (i1 int);
+INSERT INTO t1 VALUES (1),(2);
+
+CREATE TABLE t2 (i2 int);
+INSERT INTO t2 VALUES (1),(2);
+
+--error ER_SUBQUERY_NO_1_ROW
+DELETE FROM t1 ORDER BY i1 RETURNING ( SELECT i2 FROM t2 );
+
+DROP TABLE t1,t2;
\ No newline at end of file

=== modified file 'sql/sql_lex.cc'
--- a/sql/sql_lex.cc	2013-07-17 19:24:29 +0000
+++ b/sql/sql_lex.cc	2013-08-18 19:29:06 +0000
@@ -4085,7 +4085,8 @@
 void SELECT_LEX::mark_const_derived(bool empty)
 {
   TABLE_LIST *derived= master_unit()->derived;
-  if (!join->thd->lex->describe && derived)
+  /* join == NULL in  DELETE ... RETURNING */
+  if (!(join && join->thd->lex->describe) && derived)
   {
     if (!empty)
       increase_derived_records(1);



More information about the commits mailing list