mirror of
https://github.com/MariaDB/server.git
synced 2026-05-14 10:57:54 +02:00
Fix for bug #20204: "order by" changes the results returned
Item_substr's results are improperly stored in a temporary table due to wrongly calculated max_length value for multi-byte charsets if two arguments specified. mysql-test/r/ctype_utf8.result: Fix for bug #20204: "order by" changes the results returned - test case. mysql-test/t/ctype_utf8.test: Fix for bug #20204: "order by" changes the results returned - test result. sql/item_strfunc.cc: Fix for bug #20204: "order by" changes the results returned - always take into account current mbmaxlen value calculating max_length.
This commit is contained in:
parent
c19ac9ec91
commit
5d3a59fae7
3 changed files with 27 additions and 1 deletions
|
|
@ -1109,12 +1109,13 @@ void Item_func_substr::fix_length_and_dec()
|
|||
}
|
||||
if (arg_count == 3 && args[2]->const_item())
|
||||
{
|
||||
int32 length= (int32) args[2]->val_int() * collation.collation->mbmaxlen;
|
||||
int32 length= (int32) args[2]->val_int();
|
||||
if (length <= 0)
|
||||
max_length=0; /* purecov: inspected */
|
||||
else
|
||||
set_if_smaller(max_length,(uint) length);
|
||||
}
|
||||
max_length*= collation.collation->mbmaxlen;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue