Bug #56157 Output of the datetime type in case statement were shown as blob type in output
Submitted: 20 Aug 2010 19:29 Modified: 11 Nov 2010 14:52
Reporter: Igor Shevtsov Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S3 (Non-critical)
Version:Workbench 5.2.26 CE OS:Windows
Assigned to: Assigned Account CPU Architecture:Any

[20 Aug 2010 19:29] Igor Shevtsov
Description:
I just start using Workbench 5.2.26 CE 
on Windows 7 Pro 32-bit connecting through ssh tunnel to remote machine. 
When I try running a query with a case statement, columns with datetime Type are shown as "BLOB" in output window. 
To see the output data I have to right click inside of the cell, choose "Open Value in Viewer" and see text. 
This is an example of a case statement I use as part of the query: 

case 
when cancelled_on is null then '' 
when cancelled_on is not null then cancelled_on 
end as 'Cancelled On'

Should produce cells with a date of cancelled operation, but it returns blue "blob" icon instead of the date '2010-08-20'. 
If I try to Export data as CSV file, the fileds with 'blob' icons are empty. 
The code works nicely in MySQL monitor or PhPMyAdmin with properly formated fields and CSV export file has datetime fields return with proper date.

How to repeat:
This is my table:
+------------------+------------------+------+-----+---------+----------------+
| Field            | Type             | Null | Key | Default | Extra          |
+------------------+------------------+------+-----+---------+----------------+
| id               | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
| reference_number | varchar(8)       | YES  |     | NULL    |                |
| created_on       | datetime         | YES  |     | NULL    |                |
| cancelled_on     | datetime         | YES  |     | NULL    |                |
+------------------+------------------+------+-----+---------+----------------+

Data:

+----+------------------+---------------------+---------------------+
| id | reference_number | created_on          | cancelled_on        |
+----+------------------+---------------------+---------------------+
|  1 | ref12345         | 2010-06-10 00:00:00 | 2010-08-20 00:00:00 |
|  2 | ref12346         | 2010-06-11 00:00:00 | 2010-08-20 00:00:00 |
|  3 | ref12347         | 2010-06-12 00:00:00 | NULL                |
+----+------------------+---------------------+---------------------+

Query:

select 
reference_number 'Reference Number',  
created_on 'Created On',
case 
when cancelled_on is null then '' 
when cancelled_on is not null then cancelled_on 
end as 'Cancelled On
from
test1;

Returns as expected:
+------------------+---------------------+---------------------+
| Reference Number | Created On          | Cancelled On        |
+------------------+---------------------+---------------------+
| ref12345         | 2010-06-10 00:00:00 | 2010-08-20 00:00:00 |
| ref12346         | 2010-06-11 00:00:00 | 2010-08-20 00:00:00 |
| ref12347         | 2010-06-12 00:00:00 |                     |
+------------------+---------------------+---------------------+

But if I run this in Workbench SQL Editor,
Returns:
+------------------+---------------------+---------------------+
| Reference Number | Created On          | Cancelled On        |
+------------------+---------------------+---------------------+
| ref12345         | 2010-06-10 00:00:00 | blob                |
| ref12346         | 2010-06-11 00:00:00 | blob                |
| ref12347         | 2010-06-12 00:00:00 |                     |
+------------------+---------------------+---------------------+
If I export output as CSV file I have no output data in Cancelled On column.
[21 Aug 2010 0:53] MySQL Verification Team
Thank you for the bug report. Verified on Fedora 13 X86_64.
[21 Oct 2010 21:21] Eli Breen
Confirmed, same problem. Query section is...

DATE_FORMAT(ADDTIME("2000-01-01 00:00:00",
              SEC_TO_TIME(TIME_TO_SEC(HD_TICKET.TIME_CLOSED)-TIME_TO_SEC(HD_TICKET.TIME_STALLED))),"%H:%i:%s")) AS TIME_OPEN

This shows up as "Blob" and exporting this as a CSV returns nothing in the columns (Shows as "...")
[11 Nov 2010 14:52] Alfredo Kojima
This is a duplicate of bug #56642