diff options
-rw-r--r-- | mysql-test/r/order_by.result | 12 | ||||
-rw-r--r-- | mysql-test/t/order_by.test | 11 | ||||
-rw-r--r-- | sql/filesort.cc | 3 |
3 files changed, 24 insertions, 2 deletions
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index 3d0f4915d0a..4320a7764de 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -1416,3 +1416,15 @@ SELECT @tmp_tables_after = @tmp_tables_before; @tmp_tables_after = @tmp_tables_before 1 DROP TABLE t1; +# +# Bug#31590: Wrong error message on sort buffer being too small. +# +create table t1(a int, b tinytext); +insert into t1 values (1,2),(3,2); +set session sort_buffer_size= 30000; +Warnings: +Warning 1292 Truncated incorrect sort_buffer_size value: '30000' +set session max_sort_length= 2180; +select * from t1 order by b; +ERROR HY001: Out of sort memory; increase server sort buffer size +drop table t1; diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index 71238504d36..898742c2682 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -836,3 +836,14 @@ eval set @tmp_tables_after = SELECT @tmp_tables_after = @tmp_tables_before; DROP TABLE t1; +--echo # +--echo # Bug#31590: Wrong error message on sort buffer being too small. +--echo # +create table t1(a int, b tinytext); +insert into t1 values (1,2),(3,2); +set session sort_buffer_size= 30000; +set session max_sort_length= 2180; +--error 1038 +select * from t1 order by b; +drop table t1; + diff --git a/sql/filesort.cc b/sql/filesort.cc index f2216c12ce4..ebd2008512b 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -221,8 +221,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, sort_keys= table_sort.sort_keys; if (memavl < min_sort_memory) { - my_error(ER_OUTOFMEMORY,MYF(ME_ERROR+ME_WAITTANG), - thd->variables.sortbuff_size); + my_error(ER_OUT_OF_SORTMEMORY,MYF(ME_ERROR+ME_WAITTANG)); goto err; } if (open_cached_file(&buffpek_pointers,mysql_tmpdir,TEMP_PREFIX, |