List:General Discussion« Previous MessageNext Message »
From:David Garamond Date:November 29 2003 1:20am
Subject:Re: Storing binary data (string with nulls/ASCII 0 in them) in CHAR/VARCHAR?
View as plain text  
David Garamond wrote:
> insert into t1 values (3,char(32));
> Record 3, 5, and 7 is rejected due to duplicate value.
> 
> +----+--------------+------+
> | id | length(code) | code |
> +----+--------------+------+
> |  1 |            0 |      |
> |  2 |            1 | 0    |
> |  4 |            2 | 0 0  |
> |  6 |            2 | 32 0 |
> +----+--------------+------+
> 4 rows in set (0.00 sec)
> 
> It seems the string in CHAR/VARCHAR is stored as null-terminated ala C. 
> But why is record 3 rejected too?

Ugh, never mind. I forgot about the automatic trailing blanks removal 
feature. Well, since trailing blanks are always removed, it means 
CHAR/VARCHAR could never store binary data then...

Is there a 128-bit datatype planned? It would be handy to store 
GUID/UUID or IPv6 addresses.

-- 
dave


Thread
Storing binary data (string with nulls/ASCII 0 in them) in CHAR/VARCHAR?David Garamond29 Nov
  • Re: Storing binary data (string with nulls/ASCII 0 in them) in CHAR/VARCHAR?David Garamond29 Nov
    • Re: Storing binary data (string with nulls/ASCII 0 in them) in CHAR/VARCHAR?Dan Nelson29 Nov