summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <kaa@polly.(none)>2007-10-23 15:52:27 +0400
committerunknown <kaa@polly.(none)>2007-10-23 15:52:27 +0400
commit619bb76ba7a15b813548595c0454f858d6536323 (patch)
treece56a12b5a2f424947e5354da47984a4b6b8331a
parente259d46103f743de343c78e4a88b13ebd274e05a (diff)
parentbbce18c303f1779ee5386b4f1aedf3de3e19b97c (diff)
downloadmariadb-git-619bb76ba7a15b813548595c0454f858d6536323.tar.gz
Merge polly.(none):/home/kaa/src/opt/bug31742/my50-bug28550
into polly.(none):/home/kaa/src/opt/bug31742/my51-bug28550 sql/filesort.cc: SCCS merged
-rw-r--r--mysql-test/r/delete.result8
-rw-r--r--mysql-test/t/delete.test15
-rw-r--r--sql/filesort.cc5
3 files changed, 27 insertions, 1 deletions
diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result
index 5084498c01c..eb93c69d960 100644
--- a/mysql-test/r/delete.result
+++ b/mysql-test/r/delete.result
@@ -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 --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test
index 8a03cb6c715..602e30687c8 100644
--- a/mysql-test/t/delete.test
+++ b/mysql-test/t/delete.test
@@ -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 --git a/sql/filesort.cc b/sql/filesort.cc
index b6a5d844eac..c074f90e780 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -556,7 +556,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
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)
{
@@ -573,6 +573,9 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
file->ha_rnd_end();
}
+ if (thd->net.report_error)
+ DBUG_RETURN(HA_POS_ERROR);
+
/* Signal we should use orignal column read and write maps */
sort_form->column_bitmaps_set(save_read_set, save_write_set);