Bug #1868 Error in QUOTE() function
Submitted: 18 Nov 2003 5:07 Modified: 12 Dec 2003 4:43
Reporter: [ name withheld ] Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.0.16-nt OS:Windows (Windows 2000)
Assigned to: Bugs System CPU Architecture:Any

[18 Nov 2003 5:07] [ name withheld ]
Description:
If parameter contains symbols with a code more than 127 - function will return value with leading dust.

How to repeat:
select hex(quote(concat(char(224),char(227),char(230),char(231),char(232),char(234),char(235))))

E0E3E6E7E8EA27E0E3E6E7E8EAEB27

must be

27E0E3E6E7E8EAEB27

Suggested fix:
File: sql\item_strfunc.cpp
Function: String *Item_func_quote::val_str(String *str)

instead declaration
  char *from, *to, *end, *start;

must be
  uchar *from, *to, *end, *start;
[18 Nov 2003 14:42] Dean Ellis
Verified in 4.0.16 on Windows.  Does not occur in 4.0.17/Linux.

Thank you.
[12 Dec 2003 4:37] Michael Widenius
Thanks for the exellent bug report.
The fix will be in 4.0.17
[12 Dec 2003 4:43] Victor Vagin
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html