For instance, let's take this scenario for using the new char_to_uuid() internal function (in Firebird 2.5 RC2):
- Code: Select all
select
char_to_uuid ('25002304-1702-95B4-7449-F94FED240D9D')
from
rdb$database;
The query above will display an empty result, although the conversion is correctly done by char_to_uuid().
As the second pair in the literal passed to char_to_uuid() is "00", it becomes the first octet after transformed. As an octet, the result of the function creates the correct value, but when viewed as null-terminated string, it shows an empty value.
Even if we type cast the result of the query to octets (expliciting the result type of the function), we get an empty string as result:
- Code: Select all
select
cast ( char_to_uuid ('25002304-1702-95B4-7449-F94FED240D9D') as char(16) character set octets )
from
rdb$database;
To confirm char_to_uuid() is working fine, just runs the following query:
- Code: Select all
select
uuid_to_char (char_to_uuid ('25002304-1702-95B4-7449-F94FED240D9D'))
from
rdb$database;
The query above converts the hyphenized/string version of the UUID to Octets, then converts it back to string, proving the function is working as expected.
Initially, I thougt it was a bug in Firebird 2.5 RC2, so I ended up adding the issue as bug to the bug tracker: http://tracker.firebirdsql.org/browse/CORE-2905
However, a team guy warned be about the zero-pair issue.
IBExpert's grids should take the character set into account and display such values as hexa pairs, instead of assuming the "char(16)" in the row definition as being displayable as string.
Thanks in advance,
Paulo França
