On Wed, 6 Jan 2016 21:59:53 -0200, Adriano dos Santos Fernandes
<adrian...@gmail.com> wrote:
>> I have one concern though, as I indicated in the ticket the problem 
>> **only** occurs if the UUID column (a char(16) octets) has an index. If

>> the field doesn't have an index, the error does not occur with the
exact 
>> same parameter definition!
>> 
> 
> Your assumption is not correct. Problems happens even without an index.

That is not what I see when testing this.

I have tested two dozen combinations (no index, primary key, foreign key,
unique key, normal index) x (no explicit cast, cast parameter to UTF8, cast
parameter to ASCII) x (connection encoding UTF8, connection encoding
WIN1252) and only the combinations (primary key, foreign key, unique key,
normal index) x (no explicit cast) x (connection encoding UTF8) fail with
the error. Tests without an index on the field, or with an explicit cast,
or with connection encoding WIN1252 pass. In all instances the field
descriptor in the XSQLVAR was the same, but the behavior of Firebird
wasn't. To me this looks like the server doesn't do a conversion from UTF8
to ASCII before calling the function when an index is present on the field.
 
>> So I don't understand why this should be addressed by a fix like this 
>>
(https://github.com/FirebirdSQL/core/commit/c5cd8a87e58884f2dc5477dc960eece974242351).
>>
>> As it works without an index and fails with an index, to me it seems 
>> that either some sort of conversion is done or not done or character
set 
>> information is stripped away when an index is present.
>> 
>> Also I see one potential flaw with the fix in the above commit: if the 
>> parameter would be in character set octets, then the padding character 
>> is not a space, but 0x00.
>> 
> 
> CHAR_TO_UUID expects an ASCII string as parameter.

Yes, but the problem here is that Firebird seems to pass an UTF8 byte
sequence without conversion to ASCII first. And what happens if someone has
a human readable UUID stored in an OCTETS field that is longer than 36
bytes and wants to convert it to a 16 byte UUID?

Mark

------------------------------------------------------------------------------
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to