Bug #30664 VARBINARY <> VAR_STRING + BINARY
Submitted: 28 Aug 2007 9:41 Modified: 31 Aug 2007 16:21
Reporter: Tonci Grgin
Status: Closed
Category:Connector/J Severity:S2 (Serious)
Version:3.1, 5.0 SVN OS:Any
Assigned to: Target Version:

[28 Aug 2007 9:41] Tonci Grgin
Description:
c/J is not checking for binary collation when discovered type is (VAR)STRING.

How to repeat:
Test case is provided.

drop table if exists i18970_1, i18970_2;
create table i18970_1 (id int);
create table i18970_2 (id int ,binaryvalue varbinary(10));
insert into i18970_1 value (1),(2),(3);
insert into i18970_2 value (1,"‚ ‚¢‚¤"),(2,"‚ ‚¢‚¤"),(3,"‚
‚¢‚¤");
select i18970_1.id, (select i18970_2.binaryvalue from i18970_2 where
i18970_2.id=i18970_1.id) as value from i18970_1;
Column 2 ("value") is returned as MySQL data type: 253(FIELD_TYPE_VAR_STRING) and
translated to java.lang.String VARCHAR 10.

Suggested fix:
-
[28 Aug 2007 9:42] Tonci Grgin
Test case

Attachment: TestIssue18970.java (text/x-java), 2.22 KiB.

[28 Aug 2007 9:43] Tonci Grgin
Same problem in c/NET: Bug#25605, BINARY and VARBINARY is returned as a string
[30 Aug 2007 17:22] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/33446
[30 Aug 2007 17:33] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/33447
[30 Aug 2007 17:52] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/33448
[30 Aug 2007 19:04] Mark Matthews
Will be in 5.0.8 when it's released. Note that the fix only works with MySQL-5.0.25 or
newer (see changelog entry for reason why).
[30 Aug 2007 22:59] Mark Matthews
Fix will be available in 5.0.8.
[31 Aug 2007 16:21] MC Brown
A note has been added to the 5.0.8 changelog: 

Collation on VARBINARY column types would be misidentified. A fix has been added, but
this fix only works for MySQL server versions 5.0.25 and newer, since earlier versions
didn't consistently return correct metadata for functions, and thus results from
subqueries and functions were indistinguishable from each other, leading to type-related
bugs.
[6 Sep 2007 17:13] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/33832
[7 Sep 2007 16:04] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/33909
[3 Oct 2007 18:41] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/34839
[3 Oct 2007 18:46] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/34840
[3 Oct 2007 20:59] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/34855
[5 Oct 2007 20:53] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/35011
[11 Oct 2007 22:10] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/35407
[11 Oct 2007 22:24] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/35410
[11 Oct 2007 22:52] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/35414
[19 Nov 2007 1:57] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/38019
[19 Nov 2007 3:51] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/38024