List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:December 3 2004 8:30pm
Subject:Re: if last binary byte is space (ascii 32) mysql drops it
View as plain text  
At 14:10 -0600 12/3/04, Dan Nelson wrote:
>In the last episode (Dec 03), Mark Maunder said:
>>  This all started when one of the 16 byte binary primary keys kicked out
>>  a duplicate key error. It seems mysql does not store the last byte of
>>  the binary value if it is a space. That is, ascii 32 or hex 20.
>>
>>  How do I force it to store the space? Thanks!
>>
>>  create table testtable ( id binary(16) NOT NULL PRIMARY KEY ) ENGINE=MyISAM;
>
>There is no native mysql BINARY type; it's mapped to CHAR(n) BINARY.
>CHARS and VARCHARS trim trailing blanks (A known issue, but low
>priority I think).  Try using a TINYBLOB column type instead.

I agree about using the TINYBLOB to avoid trailing space truncation, but
BINARY and VARBINARY are MySQL data types now.

http://dev.mysql.com/doc/mysql/en/BINARY_VARBINARY.html

-- 
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com
Thread
if last binary byte is space (ascii 32) mysql drops itMark Maunder3 Dec
  • Re: if last binary byte is space (ascii 32) mysql drops itDan Nelson3 Dec
    • Re: if last binary byte is space (ascii 32) mysql drops itMark Maunder3 Dec
    • Re: if last binary byte is space (ascii 32) mysql drops itPaul DuBois3 Dec
      • Re: if last binary byte is space (ascii 32) mysql drops itMark Maunder3 Dec
Re: if last binary byte is space (ascii 32) mysql drops itHeikki Tuuri3 Dec