Bug #94957 FEATURE REQUEST: option to display BINARY fields as HEXADECIMAL
Submitted: 9 Apr 2019 20:42 Modified: 14 May 2019 21:06
Reporter: Steve Shaw Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S4 (Feature request)
Version:8.0 OS:Windows
Assigned to: CPU Architecture:Any

[9 Apr 2019 20:42] Steve Shaw
Description:
Instead of just showing the word BLOB for a BINARY field, it would be useful to display the field bytes in HEXADECIMAL.  
That is, an editor option that would do the equivalent of HEX(mybinary) for display.
With this option, a BINARY(16) would automatically display with 32 hex characters:  

1234567890abcdef1234567890abcdef

or if you prefer

0x1234567890abcdef1234567890abcdef

The benefit is that the default query would show the field; e.g. 

  SELECT * FROM mytable;

Otherwise, to see all the fields, I have to explicitly HEX() each binary:

  SELECT ID, Name, HEX(MyBinary), ... FROM mytable;

Especially useful for:

  Seeing the value of a 128-bit GUID or MD5 checksum.

How to repeat:
CREATE TABLE `mytable` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(255) DEFAULT NULL,
  `MyBinary` binary(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
  PRIMARY KEY (`ID`),
) ENGINE=InnoDB AUTO_INCREMENT=472 DEFAULT CHARSET=latin1;

Suggested fix:
menu Edit > Preferences > SQL Editor > SQL Execution

under existing option:
   [] Treat BINARY/VARBINARY as nonbinary character string

add a new option:
   [] Display BINARY/VARBINARY as HEX string

NOTE: These would be *mutually exclusive* options -- don't allow both to be checked at same time.

NOTE: HEX string requires two characters to display each BINARY byte.
[14 May 2019 21:06] MySQL Verification Team
Thank you for the feature request.
[1 Aug 2023 11:53] MySQL Verification Team
Bug #111931 marked as duplicate of this one.