Let's look at the manual a little: http://dev.mysql.com/doc/refman/5.1/en/string- functions.html#function_unhex
"The return value is a binary string." So the return value of UNHEX might very well be 2, but it is not of a numeric type, rather a string. Since the value 2 in UTF-8 (or ASCII, see http://www.asciitable.com/) doesn't map to any visible character, it seems the output is correct. In fact, you can see the number 2 by using the ASCII() function: drizzle> SELECT ASCII(UNHEX(2)); +-----------------+ | ASCII(UNHEX(2)) | +-----------------+ | 2 | +-----------------+ 1 row in set (0.005334 sec) Otoh, if you tried UNHEX('41') you should see 'A'. drizzle> SELECT ASCII('A'); +------------+ | ASCII('A') | +------------+ | 65 | +------------+ 1 row in set (0.00017 sec) drizzle> SELECT HEX('A'); +----------+ | HEX('A') | +----------+ | 41 | +----------+ 1 row in set (0.000176 sec) drizzle> SELECT UNHEX(41); +-----------+ | UNHEX(41) | +-----------+ | A | +-----------+ 1 row in set (0.000165 sec) drizzle> (Where 65 in decimal is 41 in hex.) I'm closing this bug then. ** Changed in: drizzle Status: New => Invalid -- You received this bug notification because you are a member of UBUNTU - AL - BR, which is subscribed to Drizzle. https://bugs.launchpad.net/bugs/923330 Title: unhex function is giving garbage results Status in A Lightweight SQL Database for Cloud Infrastructure and Web Applications: Invalid Bug description: "unhex()" function is not working properly and is returning garbage values. To manage notifications about this bug go to: https://bugs.launchpad.net/drizzle/+bug/923330/+subscriptions -- Mailing list: https://launchpad.net/~linux-traipu Post to : [email protected] Unsubscribe : https://launchpad.net/~linux-traipu More help : https://help.launchpad.net/ListHelp

