From: Ann W. Harrison Date: February 18 2009 5:17pm Subject: Re: Patch for bug#42208 List-Archive: http://lists.mysql.com/falcon/551 Message-Id: <499C42A5.2050008@mysql.com> MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=windows-1252 Content-Transfer-Encoding: 8BIT Here's what the standard (bless it's scaly two-chambered heart) has to say about binary string comparisons. 4.3.1 Introduction to binary strings A binary string is a sequence of octets that does not have either a character set or collation associated with it. A binary string type is described by a binary string type descriptor. A binary string type descriptor contains: — The name of the data type (BINARY, BINARY VARYING, or BINARY LARGE OBJECT). — The length or maximum length in octets of the binary string type A binary string is assignable only to sites of binary string type. If a store assignment would result in the loss of non-zero octets due to truncation, then an exception condition is raised. If a retrieval assignment would result in the loss of octets due to truncation, then a warning condition is raised. 4.3.2 Binary string comparison All binary string values are comparable. When binary large object string values are compared, they shall have exactly the same length (in octets) to be considered equal. Binary large object string values can be compared only for equality. For binary string values other than binary large object string values, it is implementation-defined whether trailing X'00's are considered significant when comparing two binary string values that are otherwise equivalent. So, in a word, the standard writers chose to punt on whether a varbinary 0x00 ix the same as 0x0000 when it's a varbinary, but say that they aren't equal if they're blobs. ("punt" - expression from American football, meaning give the ball a good hard kick and let the other team deal with it. Has nothing to do with "punt" the square boat propelled by poles on English rivers.) So the next question is "who is the implementer here?" Cheers, Ann