diff options
author | Ramil Kalimullin <ramil@mysql.com> | 2010-06-24 12:00:48 +0400 |
---|---|---|
committer | Ramil Kalimullin <ramil@mysql.com> | 2010-06-24 12:00:48 +0400 |
commit | 4e8728635b7fc2993374f3af98084d4f39512798 (patch) | |
tree | a07d546914c6026d9db2f22071fbf75902d6acc7 /sql | |
parent | b36a02822430ce90285f067f8e6e8d87859732aa (diff) | |
download | mariadb-git-4e8728635b7fc2993374f3af98084d4f39512798.tar.gz |
Fix for bug #54459: Assertion failed: param.sort_length,
file .\filesort.cc, line 149 (part II)
Problem: the server didn't disregard sort order
for some zero length tuples.
Fix: skip sort order in such a case
(zero length NOT NULL string functions).
mysql-test/r/select.result:
Fix for bug #54459: Assertion failed: param.sort_length,
file .\filesort.cc, line 149 (part II)
- test result.
mysql-test/t/select.test:
Fix for bug #54459: Assertion failed: param.sort_length,
file .\filesort.cc, line 149 (part II)
- test case.
sql/sql_select.cc:
Fix for bug #54459: Assertion failed: param.sort_length,
file .\filesort.cc, line 149 (part II)
- disregard sort order for zero length NOT NULL string functions
along with zero length NOT NULL fields.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_select.cc | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 296b18631e5..c9cca2e601f 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -564,13 +564,21 @@ JOIN::prepare(Item ***rref_pointer_array, { Item *item= *ord->item; /* - Disregard sort order if there's only "{VAR}CHAR(0) NOT NULL" fields - there. Such fields don't contain any data to sort. + Disregard sort order if there's only + zero length NOT NULL fields (e.g. {VAR}CHAR(0) NOT NULL") or + zero length NOT NULL string functions there. + Such tuples don't contain any data to sort. */ if (!real_order && - (item->type() != Item::FIELD_ITEM || - ((Item_field *) item)->field->maybe_null() || - ((Item_field *) item)->field->sort_length())) + /* Not a zero length NOT NULL field */ + ((item->type() != Item::FIELD_ITEM || + ((Item_field *) item)->field->maybe_null() || + ((Item_field *) item)->field->sort_length()) && + /* AND not a zero length NOT NULL string function. */ + (item->type() != Item::FUNC_ITEM || + item->maybe_null || + item->result_type() != STRING_RESULT || + item->max_length))) real_order= TRUE; if (item->with_sum_func && item->type() != Item::SUM_FUNC_ITEM) |