From: Lars-Erik Bjørk Date: February 20 2009 12:29pm Subject: Patch for bug#23692 List-Archive: http://lists.mysql.com/falcon/581 Message-Id: <499EA23F.8070007@sun.com> MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=ISO-8859-1 Content-Transfer-Encoding: 7BIT Hi all! This is a patch for bug#23692 (Falcon: searches fail if data is 0x00) The bug report is available here:http://bugs.mysql.com/bug.php?id=23692 Here is a copy of my comment in the commit message, to give an introduction to the patch :) The solution is to append a pad key to the upper bound search key, if its last character is equal to or greater than the pad character. This is done In order to make it position after all values with trailing characters lower than the pad character. For fields with a collation registered [if (field->collation)], there is no efficient way of checking if the last character is equal or greater than the pad character, without iterating through the entire key from the beginning. I have discussed this with Alexander who suggests to always pad the upper bound search key in these cases, and to pad it to the length of the key, instead of appending just a single character. This way I can use the existing cs->coll->strnxfrm function. In the other cases, I have checked on the last byte and appended 0x20 if the byte was >= 0x20. I have also added one more parameter to the makeKey methods to say that this is a highKey. The patch is available here http://lists.mysql.com/commits/67022 And the test and result files are available her. I forgot to "bzr add" them the first time :) http://lists.mysql.com/commits/67023