Bug #63874 Open value in viewer doesn't work if using cast as char
Submitted: 29 Dec 2011 14:56 Modified: 26 Mar 2012 18:43
Reporter: Bob Dankert Email Updates:
Status: Closed Impact on me:
Category:MySQL Workbench: SQL Editor Severity:S2 (Serious)
Version:5.2.37 OS:Any (W7 64, Mac OS X)
Assigned to: CPU Architecture:Any
Tags: cast, char, open value in viewer

[29 Dec 2011 14:56] Bob Dankert
The "Open value in viewer" window doesn't work when on a text field that I wrap in a "cast(field as char)" function.  The option shows up in the menu, but the value viewer window never opens.

How to repeat:
1.  Execute a query like this:
select cast(`text_field` as char) as fieldname from `table_name`
2.  Right click and try to open the resulting text in the value viewer - the window never opens

Suggested fix:
The value viewer should still work when using the cast(field as char) function
[29 Dec 2011 15:22] Bob Dankert
Screenshot of issue

Attachment: Empty Text.JPG (image/pjpeg, text), 28.80 KiB.

[29 Dec 2011 15:23] Bob Dankert
Sorry, posted the file to the wrong bug.  Please ignore that attachment.
[29 Dec 2011 15:26] Valeriy Kravchuk
Verified just as described with 5.2.37 on Mac OS X. This is the table and data I had used (server version was 5.5.20):

mysql> CREATE TABLE `tblfinalistler` (
    ->   `fldID` int(10) unsigned NOT NULL AUTO_INCREMENT,
    ->   `fldIsim` varchar(45) DEFAULT NULL,
    ->   `fldToplamOy` int(10) unsigned DEFAULT NULL,
    ->   `fldTarih` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    ->   PRIMARY KEY (`fldID`),
    ->   KEY `OY` (`fldToplamOy`)
Query OK, 0 rows affected (0.90 sec)

mysql> create table ttext(id int primary key, c1 text);
Query OK, 0 rows affected (0.96 sec)

mysql> insert into ttext values(1, 'aaaaaabbbbb');
Query OK, 1 row affected (0.16 sec)

mysql> select cast(c1 as char) as c1 from ttext;
| c1          |
| aaaaaabbbbb |
1 row in set (0.07 sec)

Workbench shows nothing when I asked to open this value in viewer, exactly as you reported.
[26 Mar 2012 18:43] Philip Olson
Fixed as of 5.2.39, and the changelog entry is as follows:

The "Open value in viewer" window did not open
with SELECT queries that used the cast function.