List:Commits« Previous MessageNext Message »
From:Alexey Kopytov Date:October 22 2007 12:10pm
Subject:bk commit into 5.0 tree (kaa:1.2547) BUG#31742
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of kaa. When kaa does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-10-22 16:10:08+04:00, kaa@polly.(none) +3 -0
  Fix for bug #31742: delete from ... order by function call that causes
  an error, asserts server
  
  In case of a fatal error during filesort in find_all_keys() the error
  was returned without the necessary handler uninitialization.
  Fixed by changing the code so that handler uninitialization is performed
  before returning the error.

  mysql-test/r/delete.result@stripped, 2007-10-22 16:10:03+04:00, kaa@polly.(none) +8 -0
    Added a test case for bug #31742.

  mysql-test/t/delete.test@stripped, 2007-10-22 16:10:03+04:00, kaa@polly.(none) +15 -0
    Added a test case for bug #31742.

  sql/filesort.cc@stripped, 2007-10-22 16:10:03+04:00, kaa@polly.(none) +4 -1
    In case of a fatal error in find_all_keys() do not return before doing
    the necessary handler uninitialization steps.

diff -Nrup a/mysql-test/r/delete.result b/mysql-test/r/delete.result
--- a/mysql-test/r/delete.result	2007-09-12 01:52:24 +04:00
+++ b/mysql-test/r/delete.result	2007-10-22 16:10:03 +04:00
@@ -271,3 +271,11 @@ a
 DROP TABLE t1, t2;
 DROP DATABASE db1;
 DROP DATABASE db2;
+CREATE FUNCTION f1() RETURNS INT RETURN 1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (0);
+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;
+End of 5.0 tests
diff -Nrup a/mysql-test/t/delete.test b/mysql-test/t/delete.test
--- a/mysql-test/t/delete.test	2007-09-11 02:41:38 +04:00
+++ b/mysql-test/t/delete.test	2007-10-22 16:10:03 +04:00
@@ -277,3 +277,18 @@ SELECT * FROM t1;
 DROP TABLE t1, t2;
 DROP DATABASE db1;
 DROP DATABASE db2;
+
+#
+# Bug 31742: delete from ... order by function call that causes an error, 
+#            asserts server
+#
+
+CREATE FUNCTION f1() RETURNS INT RETURN 1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (0);
+--error 1318
+DELETE FROM t1 ORDER BY (f1(10)) LIMIT 1;
+DROP TABLE t1;
+DROP FUNCTION f1;
+
+--echo End of 5.0 tests
diff -Nrup a/sql/filesort.cc b/sql/filesort.cc
--- a/sql/filesort.cc	2007-07-24 18:15:23 +04:00
+++ b/sql/filesort.cc	2007-10-22 16:10:03 +04:00
@@ -534,7 +534,7 @@ static ha_rows find_all_keys(SORTPARAM *
       file->unlock_row();
     /* It does not make sense to read more keys in case of a fatal error */
     if (thd->net.report_error)
-      DBUG_RETURN(HA_POS_ERROR);
+      break;
   }
   if (quick_select)
   {
@@ -551,6 +551,9 @@ static ha_rows find_all_keys(SORTPARAM *
       file->ha_rnd_end();
   }
 
+  if (thd->net.report_error)
+    DBUG_RETURN(HA_POS_ERROR);
+  
   DBUG_PRINT("test",("error: %d  indexpos: %d",error,indexpos));
   if (error != HA_ERR_END_OF_FILE)
   {
Thread
bk commit into 5.0 tree (kaa:1.2547) BUG#31742Alexey Kopytov22 Oct