List:General Discussion« Previous MessageNext Message »
From:Robin Bryce Date:December 4 2004 9:14pm
Subject:MySQL 4.1.7: cast(1-2, unsigned) != cast('18446744073709551615' as
unsigned)
View as plain text  
Hi,

I'm having trouble converting to and from strings that represent 
unsigned BIGINT's.

My server is MySQL 4.1.7-standard and

the following selects were entered at the prompt of my client with 
version "mysql Ver 14.7 Distrib 4.1.7, for pc-linux (i686)".

select cast(1-2, unsigned);

gives the expected 18446744073709551615. This is one of the 'cast' 
examples on http://dev.mysql.com/doc/mysql/en/Cast_Functions.html.

select cast(18446744073709551615 as char);

yields the expected '18446744073709551615'.

The converse doesn't hold:

cast('18446744073709551615' as unsigned);

 yields '9223372036854775807' better known as '0x7fffffffffffffff'.

Can anyone tell me what is happening here ?

Thanks,

Robin Bryce

Thread
MySQL 4.1.7: cast(1-2, unsigned) != cast('18446744073709551615' asunsigned)Robin Bryce4 Dec
  • Re: MySQL 4.1.7: cast(1-2, unsigned) != cast('18446744073709551615' as unsigned)Gleb Paharenko6 Dec
    • Re: MySQL 4.1.7: cast(1-2, unsigned) != cast('18446744073709551615'as unsigned)Robin Bryce6 Dec